def test_extensions_https(self):
        # HTTPS and allowing insecure

        # expect not to find SSL cert problem
        with self.assertRaises(Exception) as e:
            DockerUtil.wait_for_log_message(
                [self.container],
                "SSL certificate problem: self signed certificate",
                self.max_wait_time)

        # expect to find downloading extensions in to folder
        try:
            DockerUtil.wait_for_log_message([self.container],
                                            "Downloading extensions at",
                                            self.max_wait_time)
            DockerUtil.wait_for_log_message([self.container],
                                            "Unzipping contents of",
                                            self.max_wait_time)
        except Exception as e:
            self.fail(e)

        # Verify plugin.xml file for each test Extensions in MC extensions folder
        # retrieve container extensions folder
        exts = DockerUtil.list_container_dir(self.__class__.container,
                                             "/opt/connect/extensions/")
        self.assertTrue(("extensions/testExtension3/plugin.xml" in exts)
                        and ("extensions/testExtension2/plugin.xml" in exts)
                        and ("extensions/testExtension1/plugin.xml" in exts))

        # expect to see Connect start
        try:
            DockerUtil.wait_for_containers([self.container],
                                           self.max_wait_time)
        except Exception as e:
            self.fail(e)
    def test_extensions_http(self):
        # HTTP download

        # expect to find downloading extensions in to folder
        # expect to see Connect start
        try:
            # wait for extensions download message
            DockerUtil.wait_for_log_message([self.container],
                                            "Downloading extensions at",
                                            self.max_wait_time)
            DockerUtil.wait_for_log_message([self.container],
                                            "Unzipping contents of",
                                            self.max_wait_time)

            # Verify plugin.xml file for each test Extensions in MC extensions folder
            # retrieve container extensions folder
            exts = DockerUtil.list_container_dir(self.__class__.container,
                                                 "/opt/connect/extensions/")
            self.assertTrue(
                ("extensions/testExtension3/plugin.xml" in exts)
                and ("extensions/testExtension2/plugin.xml" in exts)
                and ("extensions/testExtension1/plugin.xml" in exts))

            # wait for MC to come up
            DockerUtil.wait_for_containers([self.container],
                                           self.max_wait_time)
        except Exception as e:
            # fail if there is any exception
            self.fail(e)
Beispiel #3
0
 def setUpClass(cls):
     print(
         ' \n >>>> ==== Running Test 3 - Verify Compose with secret, postgres, custom-extensions'
         + ' ===== ')
     print(' >>>> ==== using IMAGE = ' + cls.docker_image + ' ===== ')
     DockerUtil.empty_test_folder("tmp")
     # Setup test dir as volume to by mounted by container
     # exts =  DockerUtil.create_test_dir("tmp/exts")
     if os.name == 'nt':
         DockerUtil.create_test_dir("tmp\\exts")
         os.system('copy /y .\\testdata\\*.zip .\\tmp\\exts')
         os.system('copy /y .\\testdata\\secret.properties .\\tmp')
     else:
         DockerUtil.create_test_dir("tmp/exts")
         os.system('cp ./testdata/*.zip ./tmp/exts/')
         os.system('cp ./testdata/secret.properties ./tmp/')
     DockerUtil.generate_compose_yml(cls.test_yml, cls.docker_image)
     # Run docker compose
     os.system(cls.composeCmd + " up -d")
     client = docker.from_env()
     cls.container = client.containers.get("mctest3_mc_1")
     # wait for MC to come up
     try:
         DockerUtil.wait_for_containers([cls.container], cls.max_wait_time)
     except Exception, e:
         print(">>>> MC server failed to start")
         cls.tearDownClass()
         raise e
Beispiel #4
0
    def test_CustomJars_http(self):
        # HTTPS and allowing insecure

        # expect not to find SSL cert problem
        with self.assertRaises(Exception) as e:
            DockerUtil.wait_for_log_message(
                [self.container],
                "SSL certificate problem: self signed certificate",
                self.max_wait_time)

        # expect to find downloading custom jars in to folder
        try:
            DockerUtil.wait_for_log_message([self.container],
                                            "Downloading Jars at",
                                            self.max_wait_time)
            DockerUtil.wait_for_log_message([self.container],
                                            "Unzipping contents of",
                                            self.max_wait_time)
        except Exception as e:
            self.fail(e)

        # expect to see Connect start
        try:
            DockerUtil.wait_for_containers([self.container],
                                           self.max_wait_time)
        except Exception as e:
            self.fail(e)
    def test_keystore_http(self):
        # HTTP download

        # expect to find downloading keystore message
        # expect to see Connect start
        try:
            # wait for keystore download message
            DockerUtil.wait_for_log_message([self.container], "Downloading keystore at", self.max_wait_time)

            # wait for MC to come up
            DockerUtil.wait_for_containers([self.container], self.max_wait_time)
        except Exception as e:
            # fail if there is any exception
            self.fail(e)
Beispiel #6
0
 def setUpClass(cls):
     # run docker image with 2 environment variables
     print(' \n >>>> ==== Running Test 1 - Verify Environment Variables')
     print(' >>>> ==== using IMAGE = ' + cls.docker_image + ' ===== ')
     client = docker.from_env()
     cls.container = client.containers.run(
         cls.docker_image,
         environment=["SESSION_STORE=true", "VMOPTIONS=-Xmx768m"],
         detach=True,
         name="mctest1")
     # wait for MC to come up
     try:
         DockerUtil.wait_for_containers([cls.container], 60)
     except Exception, e:
         print(">>>> MC server failed to start")
         cls.tearDownClass()
         raise e
    def test_keystore_http(self):
        # HTTPS but not allowing insecure

        # expect to find downloading keystore message
        # expect to find SSL cert problem
        try:
            DockerUtil.wait_for_log_message([self.container],
                                            "Downloading keystore at",
                                            self.max_wait_time)
            DockerUtil.wait_for_log_message(
                [self.container],
                "SSL certificate problem: self signed certificate",
                self.max_wait_time)
        except Exception as e:
            self.fail(e)

        # expect Connect to not start
        with self.assertRaises(Exception) as e:
            DockerUtil.wait_for_containers([self.container],
                                           self.max_wait_time)
Beispiel #8
0
    def test_custom_jars_http(self):
        # HTTP download

        # expect to find downloading custom jars in to folder
        # expect to see Connect start
        try:
            # wait for custom jars download message
            DockerUtil.wait_for_log_message([self.container],
                                            "Downloading Jars at",
                                            self.max_wait_time)
            DockerUtil.wait_for_log_message([self.container],
                                            "Unzipping contents of",
                                            self.max_wait_time)

            # wait for MC to come up
            DockerUtil.wait_for_containers([self.container],
                                           self.max_wait_time)
        except Exception as e:
            # fail if there is any exception
            self.fail(e)
    def test_extensions_https(self):
        # HTTPS but not allowing insecure

        # expect to find downloading extensions in to folder
        # expect to find SSL cert problem
        try:
            DockerUtil.wait_for_log_message([self.container],
                                            "Downloading extensions at",
                                            self.max_wait_time)
            DockerUtil.wait_for_log_message(
                [self.container],
                "SSL certificate problem: self signed certificate",
                self.max_wait_time)
        except Exception as e:
            self.fail(e)

        # expect Connect to not start
        try:
            DockerUtil.wait_for_containers([self.container],
                                           self.max_wait_time)
        except Exception as e:
            self.fail(e)
Beispiel #10
0
 def setUpClass(cls):
     print(' \n >>>> ==== Running Test 2 - Verify Mounted Volume')
     print(' >>>> ==== using IMAGE = ' + cls.docker_image + ' ===== ')
     DockerUtil.empty_test_folder("tmp")
     # Setup test dir as volume to by mounted by container
     appdata = DockerUtil.create_test_dir("tmp/appdata")
     exts = DockerUtil.create_test_dir("tmp/extensions")
     mount = {}
     mount[appdata] = {'bind': '/opt/connect/appdata', 'mode': 'rw'}
     mount[exts] = {'bind': '/opt/connect/custom-extensions', 'mode': 'ro'}
     # run docker image with -v option
     client = docker.from_env()
     cls.container = client.containers.run(cls.docker_image,
                                           volumes=mount,
                                           detach=True,
                                           name="mctest2")
     # wait for MC to come up
     try:
         DockerUtil.wait_for_containers([cls.container], 60)
     except Exception, e:
         print(">>>> MC server failed to start")
         cls.tearDownClass()
         raise e