def simple(host): env_common(host, host, host, host) env.name = 'simple' env.postgresql_database_host = 'localhost' add_instance('default', 'default')
def single(host): env.host_ip = host env_common(tyr=(host,), ed=(host,), kraken=(host,), jormun=(host,)) env.name = 'single' env.postgresql_database_host = 'localhost' env.supervision_handler = fabfile.utils.\ ThrukSupervisionHandler(thruk_backends=[0, 1, 2, 3], ga='ga', url="url", user='******', pwd='pwd', backend='backend', host_support='host_support', token='token') env.supervision_config = dict( tyr_beat=dict( downtime=1, hosts=env.roledefs['tyr_master'], service='process_tyr_beat' ), bina=dict( downtime=2, hosts=env.roledefs['tyr'], service='data_ed_{instance}' ), kraken=dict( downtime=3, hosts=env.roledefs['ws'], service='kraken_{instance}' ) ) add_instance('default', 'default')
def test_equipment_details_provider(): i1 = add_instance('toto', 'passwd', zmq_socket_port=30001) assert len(i1.equipment_details_providers) == 0 i2 = add_instance('toto', 'passwd', equipment_providers=['provider_id1', 'provider_id2'], zmq_socket_port=30001) assert len(i2.equipment_details_providers) == 2 assert i2.equipment_details_providers[0] == 'provider_id1' assert i2.equipment_details_providers[1] == 'provider_id2'
def composed(tyr, ed, kraken, jormun): env_common(tyr, ed, kraken, jormun) env.name = 'composed' env.TYR_WORKER_START_DELAY = 30 env.APACHE_START_DELAY = 30 env.KRAKEN_START_ONLY_ONCE = False env.TYR_START_ONLY_ONCE = False env.APACHE_START_ONLY_ONCE = False env.rabbitmq_host = 'tyr' env.postgresql_database_host = 'ed' add_instance('default', 'default')
def test_default_server_altered_roledefs(): # check that attribute kraken_engines is a copy from env.roledefs, not a reference env.use_zmq_socket_file = False env.zmq_server = 'vip.truc' env.roledefs = {'eng': ('root@aaa', 'root@bbb')} instance = add_instance('toto', 'passwd', zmq_socket_port=30001) env.roledefs['eng'] = [] assert instance.kraken_engines == ['root@aaa', 'root@bbb']
def test_default_server(): env.use_zmq_socket_file = False env.zmq_server = 'vip.truc' env.roledefs = {'eng': ('root@aaa', 'root@bbb')} instance = add_instance('toto', 'passwd', zmq_socket_port=30001) assert instance.zmq_server == 'vip.truc' assert instance.kraken_engines == ['root@aaa', 'root@bbb'] assert instance.jormungandr_zmq_socket_for_instance == 'tcp://vip.truc:30001' assert instance.kraken_zmq_socket == 'tcp://*:30001'
def test_file_socket(): env.use_zmq_socket_file = True env.roledefs = {'eng': ('root@aaa', 'root@bbb')} instance = add_instance('toto', 'passwd') assert instance == env.instances['toto'] assert instance.zmq_server is None assert instance.kraken_engines == ['root@aaa', 'root@bbb'] assert instance.jormungandr_zmq_socket_for_instance == 'ipc:///srv/kraken/toto/kraken.sock' assert instance.kraken_zmq_socket == 'ipc:///srv/kraken/toto/kraken.sock'
def simple_one(addr_server_ed, addr_server_kraken=None): """ Configuration simple example. All is installed on 2 servers: * one for the data integration (addr_server_ed) * one for the rest addr_server_kraken If addr_server_kraken is not provided, all is installed on addr_server_ed the address must be ssh formated addresses like my_user@my_server """ env.use_ssh_config = True env.name = 'simple' env.distrib = 'debian8' if not addr_server_kraken: addr_server_kraken = addr_server_ed env.use_syslog = False env.postgresql_database_host = addr_server_ed env.roledefs = { 'tyr': [addr_server_ed], 'tyr_master': [addr_server_ed], 'db': [addr_server_ed], 'eng': [addr_server_kraken], 'ws': [addr_server_kraken], } env.jormungandr_url = addr_server_kraken.split('@')[-1] env.setup_apache = True env.jormungandr_save_stats = False env.jormungandr_is_public = True env.tyr_url = 'localhost:6000' # with this, the navitia packages are handled as file copied to the server and installed with `dpkg -i` env.manual_package_deploy = True env.kill_ghost_tyr_worker = True env.dry_run = False env.nb_thread_for_bina = 2 add_instance('paris', 'moovit_paris')
def test_default_server_altered_user(): env.use_zmq_socket_file = False env.zmq_server = 'vip.truc' env.roledefs = {'eng': ('navitia@aaa', 'navitia@bbb')} with settings(default_ssh_user='******'): instance = add_instance('toto', 'passwd', zmq_socket_port=30001) assert instance.zmq_server == 'vip.truc' assert instance.kraken_engines == ['navitia@aaa', 'navitia@bbb'] assert instance.jormungandr_zmq_socket_for_instance == 'tcp://vip.truc:30001' assert instance.kraken_zmq_socket == 'tcp://*:30001'
def test_default_server_altered_roledefs(): # check that attribute kraken_engines is a copy from env.roledefs, not a reference env.use_zmq_socket_file = False env.zmq_server = 'vip.truc' env.roledefs = { 'eng': ('root@aaa', 'root@bbb') } instance = add_instance('toto', 'passwd', zmq_socket_port=30001) env.roledefs['eng'] = [] assert instance.kraken_engines == ['root@aaa', 'root@bbb']
def test_single_zmq_server_noenv(): env.use_zmq_socket_file = False env.zmq_server = None env.roledefs = { 'eng': ('root@aaa', 'root@bbb') } instance = add_instance('toto', 'passwd', zmq_socket_port=30001, zmq_server='bbb') assert instance.zmq_server == 'bbb' assert instance.kraken_engines == ['root@bbb'] assert instance.jormungandr_zmq_socket_for_instance == 'tcp://bbb:30001' assert instance.kraken_zmq_socket == 'tcp://*:30001'
def test_localhost_zmq_server(): env.use_zmq_socket_file = False env.roledefs = { 'eng': ('root@aaa', 'root@bbb'), 'ws': ('root@aaa',) } instance = add_instance('toto', 'passwd', zmq_socket_port=30001, zmq_server='localhost') assert instance.zmq_server == 'localhost' assert instance.kraken_engines == ['root@aaa'] assert instance.jormungandr_zmq_socket_for_instance, 'tcp://localhost:30001' assert instance.kraken_zmq_socket == 'tcp://*:30001'
def test_default_server(): env.use_zmq_socket_file = False env.zmq_server = 'vip.truc' env.roledefs = { 'eng': ('root@aaa', 'root@bbb') } instance = add_instance('toto', 'passwd', zmq_socket_port=30001) assert instance.zmq_server == 'vip.truc' assert instance.kraken_engines == ['root@aaa', 'root@bbb'] assert instance.jormungandr_zmq_socket_for_instance == 'tcp://vip.truc:30001' assert instance.kraken_zmq_socket == 'tcp://*:30001'
def test_file_socket(): env.use_zmq_socket_file = True env.roledefs = { 'eng': ('root@aaa', 'root@bbb') } instance = add_instance('toto', 'passwd') assert instance == env.instances['toto'] assert instance.zmq_server is None assert instance.kraken_engines == ['root@aaa', 'root@bbb'] assert instance.jormungandr_zmq_socket_for_instance == 'ipc:///srv/kraken/toto/kraken.sock' assert instance.kraken_zmq_socket == 'ipc:///srv/kraken/toto/kraken.sock'
def test_localhost_zmq_server(): env.use_zmq_socket_file = False env.roledefs = {'eng': ('root@aaa', 'root@bbb'), 'ws': ('root@aaa', )} instance = add_instance('toto', 'passwd', zmq_socket_port=30001, zmq_server='localhost') assert instance.zmq_server == 'localhost' assert instance.kraken_engines == ['root@aaa'] assert instance.jormungandr_zmq_socket_for_instance, 'tcp://localhost:30001' assert instance.kraken_zmq_socket == 'tcp://*:30001'
def test_default_server_altered_user(): env.use_zmq_socket_file = False env.zmq_server = 'vip.truc' env.roledefs = { 'eng': ('navitia@aaa', 'navitia@bbb') } with settings(default_ssh_user='******'): instance = add_instance('toto', 'passwd', zmq_socket_port=30001) assert instance.zmq_server == 'vip.truc' assert instance.kraken_engines == ['navitia@aaa', 'navitia@bbb'] assert instance.jormungandr_zmq_socket_for_instance == 'tcp://vip.truc:30001' assert instance.kraken_zmq_socket == 'tcp://*:30001'
def duplicated(host1, host2): env.host1_ip, env.host2_ip = host1, host2 env_common(tyr=(host1, host2), ed=(host1,), kraken=(host1, host2), jormun=(host1,)) env.name = 'duplicated' env.eng_hosts_1 = env.roledefs['eng'][:1] env.eng_hosts_2 = env.roledefs['eng'][1:] env.eng_hosts = env.eng_hosts_1 + env.eng_hosts_2 env.ws_hosts_1 = env.roledefs['ws'][:1] env.ws_hosts_2 = env.roledefs['ws'][1:] env.ws_hosts = env.ws_hosts_1 + env.ws_hosts_2 env.postgresql_database_host = 'localhost' env.use_zmq_socket_file = False env.zmq_server = 'localhost' env.rabbitmq_host = 'localhost' add_instance("fr-nw", "passwd", zmq_socket_port=30006, is_free=True, zmq_server=(host1, host2)) add_instance("fr-ne-amiens", "passwd*", zmq_socket_port=30019, zmq_server=(host1, host2)) add_instance("fr-idf", "passwd", zmq_socket_port=30002, is_free=True, zmq_server=(host1, host2)) add_instance("fr-cen", "passwd", zmq_socket_port=30000, zmq_server=(host1, host2)) add_instance("us-wa", "passwd", zmq_socket_port=30023, is_free=True, zmq_server=(host1, host2)) add_instance("fr-npdc", "passwd", zmq_socket_port=30018, zmq_server=(host1, host2))
def artemis(): host = 'root@' + get_docker_ip('artemis') db = 'root@' + get_docker_ip(POSTGIS_HOST) env_common(host, db, host, host) env.name = 'artemis' env.postgresql_database_host = POSTGIS_HOST env.rabbitmq_host = 'rabbitmq' env.jormungandr_additional_settings['CIRCUIT_BREAKER_MAX_FAIL'] = 10 env.jormungandr_additional_settings['CIRCUIT_BREAKER_TIMEOUT_S'] = 1 add_instance("corr-02", "corr-02") add_instance("airport-01", "airport-01") add_instance("prolong-mano", "prolong-mano") add_instance("bibus", "bibus") add_instance("mission", "mission") add_instance("test-02", "test-02") add_instance("sherbrooke", "sherbrooke") add_instance("stif", "stif") add_instance("test-03", "test-03") add_instance("nb-corr-05", "nb-corr-05") add_instance("rebroussement", "rebroussement") add_instance("map", "map") add_instance("fr-pdl", "fr-pdl") add_instance("nb-corr-04", "nb-corr-04") add_instance("freqgtfs", "freqgtfs") add_instance("corr-01", "corr-01") add_instance("passe-minuit-01", "passe-minuit-01") add_instance("guichet-unique", "guichet-unique", enable_realtime=True, rt_topics=['realtime.ire']) add_instance("freqparis", "freqparis") add_instance("itl", "itl") add_instance("poitiers", "poitiers") add_instance("test-01", "test-01") add_instance("boucle-01", "boucle-01") add_instance("paysdelaloire", "paysdelaloire") add_instance("saintomer", "saintomer") add_instance("airport", "airport") add_instance("tcl", "tcl") add_instance("passe-minuit-02", "passe-minuit-02") add_instance("nb-corr-01", "nb-corr-01") add_instance("mdi", "mdi") add_instance("nb-corr-03", "nb-corr-03") add_instance("prolong-auto", "prolong-auto") add_instance("nb-corr-02", "nb-corr-02") add_instance("freqsimple", "freqsimple") add_instance("freqgtfs-01", "freqgtfs-01") add_instance("tad", "tad")
def duplicated(host1, host2): env.host1_ip, env.host2_ip = host1, host2 env_common(tyr=(host1, host2), ed=(host1, ), kraken=(host1, host2), jormun=(host1, )) env.name = 'duplicated' env.eng_hosts_1 = env.roledefs['eng'][:1] env.eng_hosts_2 = env.roledefs['eng'][1:] env.eng_hosts = env.eng_hosts_1 + env.eng_hosts_2 env.ws_hosts_1 = env.roledefs['ws'][:1] env.ws_hosts_2 = env.roledefs['ws'][1:] env.ws_hosts = env.ws_hosts_1 + env.ws_hosts_2 env.postgresql_database_host = 'localhost' env.use_zmq_socket_file = False env.zmq_server = 'localhost' env.rabbitmq_kraken_host = 'localhost' env.rabbitmq_tyr_host = 'localhost' add_instance("fr-nw", "passwd", zmq_socket_port=30006, is_free=True, zmq_server=(host1, host2)) add_instance("fr-ne-amiens", "passwd*", zmq_socket_port=30019, zmq_server=(host1, host2)) add_instance("fr-idf", "passwd", zmq_socket_port=30002, is_free=True, zmq_server=(host1, host2)) add_instance("fr-cen", "passwd", zmq_socket_port=30000, zmq_server=(host1, host2)) add_instance("us-wa", "passwd", zmq_socket_port=30023, is_free=True, zmq_server=(host1, host2)) add_instance("fr-npdc", "passwd", zmq_socket_port=30018, zmq_server=(host1, host2))
def artemis(_): host = 'root@' + get_docker_ip('artemis') db = 'root@' + get_docker_ip(POSTGIS_HOST) env_common(host, db, host, host) env.name = 'artemis' env.postgresql_database_host = POSTGIS_HOST env.rabbitmq_host = 'rabbitmq' env.jormungandr_additional_settings['CIRCUIT_BREAKER_MAX_FAIL'] = 10 env.jormungandr_additional_settings['CIRCUIT_BREAKER_TIMEOUT_S'] = 1 add_instance("corr-02", "corr-02") add_instance("airport-01", "airport-01") add_instance("prolong-mano", "prolong-mano") add_instance("bibus", "bibus") add_instance("mission", "mission") add_instance("test-02", "test-02") add_instance("sherbrooke", "sherbrooke") add_instance("stif", "stif") add_instance("test-03", "test-03") add_instance("nb-corr-05", "nb-corr-05") add_instance("rebroussement", "rebroussement") add_instance("map", "map") add_instance("fr-pdl", "fr-pdl") add_instance("nb-corr-04", "nb-corr-04") add_instance("freqgtfs", "freqgtfs") add_instance("corr-01", "corr-01") add_instance("passe-minuit-01", "passe-minuit-01") add_instance("guichet-unique", "guichet-unique", enable_realtime=True, rt_topics=['realtime.ire']) add_instance("freqparis", "freqparis") add_instance("itl", "itl") add_instance("poitiers", "poitiers") add_instance("test-01", "test-01") add_instance("boucle-01", "boucle-01") add_instance("paysdelaloire", "paysdelaloire") add_instance("saintomer", "saintomer") add_instance("airport", "airport") add_instance("tcl", "tcl") add_instance("passe-minuit-02", "passe-minuit-02") add_instance("nb-corr-01", "nb-corr-01") add_instance("mdi", "mdi") add_instance("nb-corr-03", "nb-corr-03") add_instance("prolong-auto", "prolong-auto") add_instance("nb-corr-02", "nb-corr-02") add_instance("freqsimple", "freqsimple") add_instance("freqgtfs-01", "freqgtfs-01") add_instance("tad", "tad") add_instance("fr-auv", "fr-auv")
def artemis(host): env_common(host, host, host, host) env.name = 'artemis' env.postgresql_database_host = 'artemis_post' env.cities_database_uri = 'user=cities password=cities host=artemis_post port=5432 dbname=cities' add_instance("corr-02", "corr-02") add_instance("airport-01", "airport-01") add_instance("prolong-mano", "prolong-mano") add_instance("bibus", "bibus") add_instance("mission", "mission") add_instance("test-02", "test-02") add_instance("sherbrooke", "sherbrooke") add_instance("stif", "stif") add_instance("test-03", "test-03") add_instance("nb-corr-05", "nb-corr-05") add_instance("rebroussement", "rebroussement") add_instance("map", "map") add_instance("fr-pdl", "fr-pdl") add_instance("nb-corr-04", "nb-corr-04") add_instance("freqgtfs", "freqgtfs") add_instance("corr-01", "corr-01") add_instance("passe-minuit-01", "passe-minuit-01") add_instance("guichet-unique", "guichet-unique") add_instance("freqparis", "freqparis") add_instance("itl", "itl") add_instance("poitiers", "poitiers") add_instance("test-01", "test-01") add_instance("boucle-01", "boucle-01") add_instance("paysdelaloire", "paysdelaloire") add_instance("saintomer", "saintomer") add_instance("airport", "airport") add_instance("tcl", "tcl") add_instance("passe-minuit-02", "passe-minuit-02") add_instance("nb-corr-01", "nb-corr-01") add_instance("mdi", "mdi") add_instance("nb-corr-03", "nb-corr-03") add_instance("prolong-auto", "prolong-auto") add_instance("nb-corr-02", "nb-corr-02") add_instance("freqsimple", "freqsimple") add_instance("freqgtfs-01", "freqgtfs-01") add_instance("tad", "tad")
def test_missing_zmq_port(): env.use_zmq_socket_file = False with pytest.raises(SystemExit) as excinfo: add_instance('toto', 'passwd') assert excinfo.value.message == "Instance configuration must include a ZMQ port, aborting " \ "(see fabfile.env.platforms for some instructions)"
def test_missing_zmq_port(): env.use_zmq_socket_file = False with pytest.raises(SystemExit) as excinfo: add_instance('toto', 'passwd') assert excinfo.value.message == "Instance configuration must include a zmq_socket_port, aborting " \ "(see fabfile.env.platforms for some instructions)"