Пример #1
0
 def test_from_ps(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     self.assertEqual(container.dictionary, {
         "Id": "abc",
         "Image":"busybox:latest",
         "Name": "/composetest_db_1",
     })
Пример #2
0
 def test_from_ps(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     assert container.dictionary == {
         "Id": self.container_id,
         "Image": "busybox:latest",
         "Name": "/composetest_db_1",
     }
Пример #3
0
 def test_from_ps(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     assert container.dictionary == {
         "Id": self.container_id,
         "Image": "busybox:latest",
         "Name": "/composetest_db_1",
     }
Пример #4
0
 def test_from_ps(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     self.assertEqual(container.dictionary, {
         "Id": "abc",
         "Image": "busybox:latest",
         "Name": "/composetest_db_1",
     })
Пример #5
0
 def test_from_ps(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     assert container.dictionary == {
         "Id": self.container_id,
         "Image": BUSYBOX_IMAGE_WITH_TAG,
         "Name": "/composetest_db_1",
     }
Пример #6
0
    def test_build_failed(self):
        self.base_dir = "tests/fixtures/simple-failing-dockerfile"
        self.dispatch(["build", "simple"], returncode=1)

        labels = ["com.docker.compose.test_failing_image=true"]
        containers = [
            Container.from_ps(self.project.client, c)
            for c in self.project.client.containers(all=True, filters={"label": labels})
        ]
        assert len(containers) == 1
Пример #7
0
    def test_build_failed(self):
        self.base_dir = 'tests/fixtures/simple-failing-dockerfile'
        self.dispatch(['build', 'simple'], returncode=1)

        labels = ["com.docker.compose.test_failing_image=true"]
        containers = [
            Container.from_ps(self.project.client, c)
            for c in self.project.client.containers(all=True,
                                                    filters={"label": labels})
        ]
        assert len(containers) == 1
Пример #8
0
    def test_from_ps_prefixed(self):
        self.container_dict['Names'] = ['/swarm-host-1' + n for n in self.container_dict['Names']]

        container = Container.from_ps(None,
                                      self.container_dict,
                                      has_been_inspected=True)
        self.assertEqual(container.dictionary, {
            "Id": "abc",
            "Image": "busybox:latest",
            "Name": "/composetest_db_1",
        })
Пример #9
0
    def test_from_ps_prefixed(self):
        self.container_dict['Names'] = ['/swarm-host-1' + n for n in self.container_dict['Names']]

        container = Container.from_ps(None,
                                      self.container_dict,
                                      has_been_inspected=True)
        self.assertEqual(container.dictionary, {
            "Id": "abc",
            "Image":"busybox:latest",
            "Name": "/composetest_db_1",
        })
Пример #10
0
    def test_from_ps_prefixed(self):
        self.container_dict['Names'] = [
            '/swarm-host-1' + n for n in self.container_dict['Names']
        ]

        container = Container.from_ps(None,
                                      self.container_dict,
                                      has_been_inspected=True)
        assert container.dictionary == {
            "Id": self.container_id,
            "Image": BUSYBOX_IMAGE_WITH_TAG,
            "Name": "/composetest_db_1",
        }
Пример #11
0
    def test_build_failed_forcerm(self):
        self.base_dir = 'tests/fixtures/simple-failing-dockerfile'
        self.dispatch(['build', '--force-rm', 'simple'], returncode=1)

        labels = ["com.docker.compose.test_failing_image=true"]

        containers = [
            Container.from_ps(self.project.client, c)
            for c in self.project.client.containers(
                all=True,
                filters={"label": labels})
        ]
        assert not containers
Пример #12
0
 def test_number(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     self.assertEqual(container.number, 1)
Пример #13
0
 def test_name(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     self.assertEqual(container.name, "composetest_db_1")
Пример #14
0
 def test_name(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     self.assertEqual(container.name, "composetest_db_1")
Пример #15
0
 def test_name_without_project(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     self.assertEqual(container.name_without_project, "db_1")
Пример #16
0
 def test_name_without_project(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     self.assertEqual(container.name_without_project, "db_1")
Пример #17
0
 def test_number(self):
     container = Container.from_ps(None,
                                   self.container_dict,
                                   has_been_inspected=True)
     self.assertEqual(container.number, 1)