Ejemplo n.º 1
0
 def test_find_bwc_test_script_does_not_exist(self, *mocks):
     with self.assertRaisesRegex(
             ScriptFinder.ScriptNotFoundError,
             "Could not find bwctest.sh script. Looked in .*",
     ):
         ScriptFinder.find_bwc_test_script("anything",
                                           self.component_without_scripts)
    def execute_bwctest_sh(self, config: str) -> int:
        security = self.is_security_enabled(config)
        script = ScriptFinder.find_bwc_test_script(self.component.name,
                                                   self.repo.working_directory)
        if os.path.exists(script):
            cmd = self.get_cmd(script, security, self.manifest.build.location)
            self.repo_work_dir = os.path.join(
                self.repo.dir, self.test_config.working_directory
            ) if self.test_config.working_directory is not None else self.repo.dir
            (status, stdout, stderr) = execute(cmd, self.repo_work_dir, True,
                                               False)

            test_result_data = TestResultData(self.component.name, config,
                                              status, stdout, stderr,
                                              self.test_artifact_files)
            self.save_logs.save_test_result_data(test_result_data)
            if stderr:
                logging.info("BWC test run failed for component " +
                             self.component.name)
                logging.info(stderr)
            return status
        else:
            logging.info(
                f"{script} does not exist. Skipping integ tests for {self.component.name}"
            )
            return 0
Ejemplo n.º 3
0
 def test_find_bwc_test_script_default(self):
     self.assertEqual(
         os.path.join(ScriptFinder.default_scripts_path, "bwctest.sh"),
         ScriptFinder.find_bwc_test_script("invalid",
                                           self.component_without_scripts),
         msg="A component without an override resolves to a default.",
     )
Ejemplo n.º 4
0
 def test_find_bwc_test_script_component_script_in_folder(self):
     self.assertEqual(
         os.path.join(self.component_with_scripts_folder, "scripts",
                      "bwctest.sh"),
         ScriptFinder.find_bwc_test_script(
             "foobar", self.component_with_scripts_folder),
         msg="A component with a scripts folder resolves to an override.",
     )
Ejemplo n.º 5
0
 def test_find_bwc_test_script_component_script(self):
     self.assertEqual(
         os.path.join(ScriptFinder.component_scripts_path, "OpenSearch",
                      "bwctest.sh"),
         ScriptFinder.find_bwc_test_script("OpenSearch",
                                           self.component_with_scripts),
         msg="A component with a script resolves to the script at the root.",
     )
Ejemplo n.º 6
0
 def test_find_bwc_test_script_component_override(self):
     self.assertEqual(
         os.path.join(ScriptFinder.component_scripts_path, "OpenSearch",
                      "bwctest.sh"),
         ScriptFinder.find_bwc_test_script("OpenSearch",
                                           self.component_without_scripts),
         msg="A component without scripts resolves to a component override.",
     )
Ejemplo n.º 7
0
 def test_find_bwc_test_script_component_script_in_folder_with_default(
         self):
     self.assertEqual(
         os.path.join(ScriptFinder.component_scripts_path, "OpenSearch",
                      "bwctest.sh"),
         ScriptFinder.find_bwc_test_script(
             "OpenSearch", self.component_with_scripts_folder),
         msg=
         "A component with a scripts folder resolves to a script in that folder.",
     )
Ejemplo n.º 8
0
 def run_tests(self, work_dir, component_name):
     script = ScriptFinder.find_bwc_test_script(component_name, work_dir)
     (status, stdout, stderr) = execute(script, work_dir, True, False)
     return (status, stdout, stderr)