コード例 #1
0
    def test__create_container(self, client):
        """Tests creating a docker container using the api."""

        volume_mapping = {
            'app\\data\\container_data': {
                'bind': 'c:\\container_data',
                'mode': 'ro'
            }
        }

        # Access to a protected member
        # pylint: disable=W0212
        runtime._create_container(self.tm_env, {'network': 'nat2'}, client,
                                  self.app, volume_mapping)

        client.images.pull.assert_called_with('test')
        client.containers.create.assert_called_with(
            image='test',
            name='proid.app-001-abcdefghijklm',
            environment=mock.ANY,
            entrypoint='cmd',
            command=[],
            detach=True,
            tty=True,
            ports={'80/tcp': None},
            network='nat2',
            cpu_shares=128,
            mem_limit='512M',
            storage_opt={'size': '20G'},
            volumes=volume_mapping)
コード例 #2
0
    def test__create_container(self, client):
        """Tests creating a docker container using the api."""
        # Access to a protected member
        # pylint: disable=W0212
        runtime._create_container(self.tm_env, {'network': 'nat2'}, client,
                                  self.app)

        client.images.pull.assert_called_with('test')
        client.containers.create.assert_called_with(
            image='test',
            name='proid.app-001-abcdefghijklm',
            environment=mock.ANY,
            entrypoint='cmd',
            command=[],
            detach=True,
            tty=True,
            ports={'80/tcp': '12345'},
            network='nat2',
            cpu_shares=128,
            mem_limit='512M',
            storage_opt={'size': '20G'},
            ulimits=[
                {
                    'core': 'unlimited'
                },
                {
                    'nofile': 32768
                },
            ],
        )