def test_up_with_extends(self): self.base_dir = 'tests/fixtures/extends' self.dispatch(['up', '-d'], None) self.assertEqual( set([s.name for s in self.project.services]), set(['mydb', 'myweb']), ) # Sort by name so we get [db, web] containers = sorted( self.project.containers(stopped=True), key=lambda c: c.name, ) self.assertEqual(len(containers), 2) web = containers[1] self.assertEqual( set(get_links(web)), set(['db', 'mydb_1', 'extends_mydb_1'])) expected_env = set([ "FOO=1", "BAR=2", "BAZ=2", ]) self.assertTrue(expected_env <= set(web.get('Config.Env')))
def test_up_with_multiple_files(self): self.base_dir = 'tests/fixtures/override-files' config_paths = [ 'docker-compose.yml', 'docker-compose.override.yml', 'extra.yml', ] self._project = get_project(self.base_dir, config_paths) self.dispatch( [ '-f', config_paths[0], '-f', config_paths[1], '-f', config_paths[2], 'up', '-d', ], None) containers = self.project.containers() self.assertEqual(len(containers), 3) web, other, db = containers self.assertEqual(web.human_readable_command, 'top') self.assertTrue({'db', 'other'} <= set(get_links(web))) self.assertEqual(db.human_readable_command, 'top') self.assertEqual(other.human_readable_command, 'top')
def test_up_with_multiple_files(self): self.base_dir = "tests/fixtures/override-files" config_paths = ["docker-compose.yml", "docker-compose.override.yml", "extra.yml"] self._project = get_project(self.base_dir, config_paths) self.dispatch(["-f", config_paths[0], "-f", config_paths[1], "-f", config_paths[2], "up", "-d"], None) containers = self.project.containers() self.assertEqual(len(containers), 3) web, other, db = containers self.assertEqual(web.human_readable_command, "top") self.assertTrue({"db", "other"} <= set(get_links(web))) self.assertEqual(db.human_readable_command, "top") self.assertEqual(other.human_readable_command, "top")
def test_up_with_extends(self): self.base_dir = "tests/fixtures/extends" self.dispatch(["up", "-d"], None) self.assertEqual(set([s.name for s in self.project.services]), set(["mydb", "myweb"])) # Sort by name so we get [db, web] containers = sorted(self.project.containers(stopped=True), key=lambda c: c.name) self.assertEqual(len(containers), 2) web = containers[1] self.assertEqual(set(get_links(web)), set(["db", "mydb_1", "extends_mydb_1"])) expected_env = set(["FOO=1", "BAR=2", "BAZ=2"]) self.assertTrue(expected_env <= set(web.get("Config.Env")))