Skip to content

Commit

Permalink
fix: travis configuration for 2 sites
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchamahabal committed Oct 10, 2019
1 parent 7e7192b commit 71d4380
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sudo: required
addons:
hosts:
- test_site
- test_site_2
- test_site_producer
mariadb: 10.3
postgresql: 9.5

Expand Down Expand Up @@ -51,10 +51,10 @@ install:
- bench init frappe-bench --skip-assets --python $(which python) --frappe-path $TRAVIS_BUILD_DIR

- mkdir ~/frappe-bench/sites/test_site
- cp $TRAVIS_BUILD_DIR/.travis/$DB.json ~/frappe-bench/sites/test_site/site_config.json
- cp $TRAVIS_BUILD_DIR/.travis/consumer_db/$DB.json ~/frappe-bench/sites/test_site/site_config.json

- mkdir ~/frappe-bench/sites/test_site_2
- cp $TRAVIS_BUILD_DIR/.travis/$DB.json ~/frappe-bench/sites/test_site_2/site_config.json
- mkdir ~/frappe-bench/sites/test_site_producer
- cp $TRAVIS_BUILD_DIR/.travis/producer_db/$DB.json ~/frappe-bench/sites/test_site_producer/site_config.json

- mysql -u root -e "SET GLOBAL character_set_server = 'utf8mb4'"
- mysql -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"
Expand Down Expand Up @@ -86,7 +86,7 @@ install:

- bench start &
- bench --site test_site reinstall --yes
- bench --site test_site_2 reinstall --yes
- bench --site test_site_producer reinstall --yes
- bench build --app frappe

after_script:
Expand Down
2 changes: 1 addition & 1 deletion .travis/mariadb.json → .travis/consumer_db/mariadb.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"root_login": "root",
"root_password": "travis",
"host_name": "http://test_site:8000"
}
}
File renamed without changes.
14 changes: 14 additions & 0 deletions .travis/producer_db/mariadb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"db_host": "localhost",
"db_name": "test_frappe",
"db_password": "test_frappe",
"db_type": "mariadb",
"auto_email_id": "[email protected]",
"mail_server": "smtp.example.com",
"mail_login": "[email protected]",
"mail_password": "test",
"admin_password": "admin",
"root_login": "root",
"root_password": "travis",
"host_name": "http://test_site_producer:8000"
}
14 changes: 14 additions & 0 deletions .travis/producer_db/postgres.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"db_host": "localhost",
"db_name": "test_frappe",
"db_password": "test_frappe",
"db_type": "postgres",
"auto_email_id": "[email protected]",
"mail_server": "smtp.example.com",
"mail_login": "[email protected]",
"mail_password": "test",
"admin_password": "admin",
"root_login": "postgres",
"root_password": "travis",
"host_name": "http://test_site_producer:8000"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def create_event_producer():
event_producer = frappe.new_doc('Event Producer')
event_producer.producer_url = 'http://test_site_2:8000'
event_producer.producer_url = 'http://test_site_producer:8000'
event_producer.append('event_configuration', {
'ref_doctype': 'ToDo',
'use_same_name': 1
Expand All @@ -22,7 +22,7 @@ def create_event_producer():

class TestEventProducer(unittest.TestCase):
def setUp(self):
if not frappe.db.exists('Event Producer', 'http://test_site_2:8000'):
if not frappe.db.exists('Event Producer', 'http://test_site_producer:8000'):
create_event_producer()
frappe.db.sql('delete from tabToDo')
frappe.db.sql('delete from tabNote')
Expand Down Expand Up @@ -130,7 +130,7 @@ def test_dynamic_link_dependencies_synced(self):
def test_naming_configuration(self):
#test with use_same_name = 0
frappe.clear_cache(doctype='ToDo')
event_producer = frappe.get_doc('Event Producer', 'http://test_site_2:8000')
event_producer = frappe.get_doc('Event Producer', 'http://test_site_producer:8000')
event_producer.event_configuration = []
event_producer.append('event_configuration', {
'ref_doctype': 'ToDo'
Expand All @@ -139,7 +139,7 @@ def test_naming_configuration(self):
producer = get_remote_site()
producer_doc = self.insert_into_producer(producer, 'test different name sync')
self.pull_producer_data()
self.assertTrue(frappe.db.exists('ToDo', {'remote_docname': producer_doc.name, 'remote_site_name': 'http://test_site_2:8000'}))
self.assertTrue(frappe.db.exists('ToDo', {'remote_docname': producer_doc.name, 'remote_site_name': 'http://test_site_producer:8000'}))

def test_update_log(self):
self.subscribe_to_doctypes(['ToDo'])
Expand All @@ -157,7 +157,7 @@ def test_event_sync_log(self):

def subscribe_to_doctypes(self, doctypes):
frappe.clear_cache(doctype='ToDo')
event_producer = frappe.get_doc('Event Producer', 'http://test_site_2:8000')
event_producer = frappe.get_doc('Event Producer', 'http://test_site_producer:8000')
event_producer.event_configuration = []
for d in doctypes:
event_producer.append('event_configuration', {
Expand All @@ -172,7 +172,7 @@ def insert_into_producer(self, producer, description):
return producer.insert(todo)

def pull_producer_data(self):
pull_from_node('http://test_site_2:8000')
pull_from_node('http://test_site_producer:8000')
time.sleep(1)

def make_email_account_in_producer(producer, name, email_id):
Expand All @@ -190,7 +190,7 @@ def make_email_account_in_producer(producer, name, email_id):
return producer.insert(doc)

def get_remote_site():
producer_doc = frappe.get_doc('Event Producer', 'http://test_site_2:8000')
producer_doc = frappe.get_doc('Event Producer', 'http://test_site_producer:8000')
producer_site = FrappeClient(
url=producer_doc.producer_url,
api_key=producer_doc.api_key,
Expand Down

0 comments on commit 71d4380

Please sign in to comment.