コード例 #1
0
class TestGunicornDockerRunner(unittest.TestCase):
    """
    Test the docker runner for the Postgres service
    """
    def setUp(self):
        self.name = 'livetest-gunicorn-{}'.format(gen_salt(5))
        self.builder = GunicornDockerRunner(
            image='adsabs/pythonsimpleserver:v1.0.0',
            name=self.name,
        )

    def tearDown(self):
        """
        teardown the containers
        """
        try:
            self.builder.teardown()
        except:
            pass

    def test_is_ready(self):
        """
        Check if the instance is ready
        """

        self.builder.start()

        self.assertTrue(self.builder.running)
        self.assertTrue(self.builder.ready)

        self.builder.teardown()
        self.assertFalse(self.builder.ready)
        self.assertFalse(self.builder.running)
コード例 #2
0
class TestGunicornDockerRunner(unittest.TestCase):
    """
    Test the docker runner for the Postgres service
    """

    def setUp(self):
        self.name = 'livetest-gunicorn-{}'.format(gen_salt(5))
        self.builder = GunicornDockerRunner(
            image='adsabs/pythonsimpleserver:v1.0.0',
            name=self.name,
        )

    def tearDown(self):
        """
        teardown the containers
        """
        try:
            self.builder.teardown()
        except:
            pass

    def test_is_ready(self):
        """
        Check if the instance is ready
        """

        self.builder.start()

        self.assertTrue(self.builder.running)
        self.assertTrue(self.builder.ready)

        self.builder.teardown()
        self.assertFalse(self.builder.ready)
        self.assertFalse(self.builder.running)
コード例 #3
0
    def test_run_test_environment_task(self):
        """
        Test that we can start tests in the test environment
        """
        test_id = '34fef34fsdf'

        name = 'livetest-pythonserver-{}'.format(test_id)

        container = GunicornDockerRunner(
            name=name, image='adsabs/pythonsimpleserver:v1.0.0')
        container.start()

        run_test_in_environment(test_id=test_id,
                                test_services=['adsrex'],
                                api_name=name)
コード例 #4
0
ファイル: test_tasks.py プロジェクト: adsabs/mission-control
    def test_run_test_environment_task(self):
        """
        Test that we can start tests in the test environment
        """
        test_id = '34fef34fsdf'

        name = 'livetest-pythonserver-{}'.format(test_id)

        container = GunicornDockerRunner(
            name=name,
            image='adsabs/pythonsimpleserver:v1.0.0'
        )
        container.start()

        run_test_in_environment(
            test_id=test_id,
            test_services=['adsrex'],
            api_name=name
        )
コード例 #5
0
class TestTestProvisioner(unittest.TestCase):
    """
    Test the provisioning of the test cluster script
    """

    def setUp(self):
        """
        Setup the tests
        """
        self.name = 'livetest-adsws-pythonsimpleserver-{}'.format(gen_salt(5))
        self.builder = GunicornDockerRunner(
            image='adsabs/pythonsimpleserver:v1.0.0',
            name=self.name,
        )
        self.builder.start()
        info = self.builder.client.port(
            self.builder.container['Id'],
            80
        )[0]
        self.host = info['HostIp']
        self.port = info['HostPort']

    def tearDown(self):
        """
        Teardown the tests
        """
        self.builder.teardown()

    def test_that_the_script_file_is_provisioned(self):
        """
        Tests that the script file is provisioned as we expect it to be
        """
        test_provisioner = TestProvisioner(services=['adsrex'])

        api_url = 'API_URL="http://{host}:{port}"'.format(
            host=self.host,
            port=self.port
        )
        self.assertIn(api_url, test_provisioner.scripts[0])