|
| 1 | +import subprocess |
| 2 | +import tarfile |
| 3 | +import unittest |
| 4 | +from tempfile import TemporaryDirectory |
| 5 | + |
| 6 | +import docker |
| 7 | +import utils as exaslct_utils # type: ignore # pylint: disable=import-error |
| 8 | +from exasol_integration_test_docker_environment.lib.models.data.environment_type import ( |
| 9 | + EnvironmentType, |
| 10 | +) |
| 11 | +from exasol_integration_test_docker_environment.testing import utils # type: ignore |
| 12 | + |
| 13 | +from exasol.slc import api |
| 14 | +from exasol.slc.models.compression_strategy import CompressionStrategy |
| 15 | + |
| 16 | + |
| 17 | +class ApiDockerRunDbTestSingleFile(unittest.TestCase): |
| 18 | + # |
| 19 | + # Spawn a Docker db and run test for single file. |
| 20 | + # |
| 21 | + def setUp(self): |
| 22 | + print(f"SetUp {self.__class__.__name__}") |
| 23 | + self.test_environment = exaslct_utils.ExaslctApiTestEnvironmentWithCleanup( |
| 24 | + self, True |
| 25 | + ) |
| 26 | + self.test_environment.clean_all_images() |
| 27 | + |
| 28 | + def tearDown(self): |
| 29 | + utils.close_environments(self.test_environment) |
| 30 | + |
| 31 | + def test_run_db_test_single_file(self): |
| 32 | + result = api.run_db_test( |
| 33 | + flavor_path=(str(exaslct_utils.get_test_flavor()),), |
| 34 | + test_container_folder=str(exaslct_utils.get_full_test_container_folder()), |
| 35 | + output_directory=self.test_environment.output_dir, |
| 36 | + test_file=("empty_test.py",), |
| 37 | + ) |
| 38 | + flavor_keys = list(result.test_results_per_flavor.keys()) |
| 39 | + self.assertEqual(len(flavor_keys), 1) |
| 40 | + flavor_key = flavor_keys[0] |
| 41 | + |
| 42 | + test_result_per_flavor = result.test_results_per_flavor[flavor_key] |
| 43 | + test_result_per_release = test_result_per_flavor.test_results_per_release_goal[ |
| 44 | + "release" |
| 45 | + ] |
| 46 | + test_file_output = test_result_per_release.test_files_output |
| 47 | + self.assertEqual(len(test_file_output.test_results), 1) |
| 48 | + test_results = test_file_output.test_results[0] |
| 49 | + self.assertEqual(len(test_results.test_results), 1) |
| 50 | + test_result = test_results.test_results[0] |
| 51 | + self.assertEqual(test_result.test_file, "empty_test.py") |
| 52 | + self.assertEqual(test_result.language, "None") |
| 53 | + self.assertTrue(test_result.is_ok) |
| 54 | + |
| 55 | + |
| 56 | +if __name__ == "__main__": |
| 57 | + unittest.main() |
0 commit comments