def setUp(self) -> None:
        self.data_path = os.path.realpath(
            os.path.join(os.path.dirname(__file__), "data"))
        self.manifest_filename = os.path.join(self.data_path,
                                              "opensearch-bundle-1.1.0.yml")
        self.manifest = BundleManifest.from_path(self.manifest_filename)

        self.manifest_distribution_filename = os.path.join(
            self.data_path, "opensearch-bundle-1.3.0.yml")
        self.manifest_distribution = BundleManifest.from_path(
            self.manifest_distribution_filename)
    def test_install_maven_dependencies_remote(self, mock_request, mock_copyfile, mock_makedirs):
        counter = ThreadSafeCounter()
        mock_request.side_effect = counter.thread_safe_count
        dependency_installer = DependencyInstallerOpenSearch(
            "https://ci.opensearch.org/x/y",
            BuildManifest.from_path(self.BUILD_MANIFEST),
            BundleManifest.from_path(self.DIST_MANIFEST_REMOTE)
        )

        dependency_installer.install_maven_dependencies()
        self.assertEqual(counter.call_count, 2375)

        mock_makedirs.assert_called_with(
            os.path.realpath(
                os.path.join(
                    dependency_installer.maven_local_path, "org", "opensearch", "notification"
                )
            ),
            exist_ok=True
        )
        mock_copyfile.assert_not_called()
        mock_request.assert_has_calls([
            call(
                "https://ci.opensearch.org/x/y/builds/opensearch/maven/org/opensearch/notification/alerting-notification-1.2.0.0.jar",
                os.path.realpath(os.path.join(dependency_installer.maven_local_path, "org", "opensearch", "notification", "alerting-notification-1.2.0.0.jar"))
            )
        ])
示例#3
0
    def test_install_maven_dependencies_local(self, mock_request: Mock,
                                              mock_copyfile: Mock,
                                              mock_makedirs: Mock) -> None:
        counter = ThreadSafeCounter()
        mock_copyfile.side_effect = counter.thread_safe_count

        dependency_installer = DependencyInstallerOpenSearch(
            self.DATA, BuildManifest.from_path(self.BUILD_MANIFEST),
            BundleManifest.from_path(self.DIST_MANIFEST_LOCAL))

        dependency_installer.install_maven_dependencies()

        mock_makedirs.assert_called_with(os.path.realpath(
            os.path.join(dependency_installer.maven_local_path, "org",
                         "opensearch", "notification")),
                                         exist_ok=True)
        mock_request.assert_not_called()
        self.assertEqual(counter.call_count, 2375)
        mock_copyfile.assert_has_calls([
            call(
                os.path.join(self.DATA, "builds", "opensearch", "maven", "org",
                             "opensearch", "notification",
                             "alerting-notification-1.2.0.0.jar"),
                os.path.realpath(
                    os.path.join(dependency_installer.maven_local_path, "org",
                                 "opensearch", "notification",
                                 "alerting-notification-1.2.0.0.jar")))
        ])
 def test_versions(self) -> None:
     self.assertTrue(len(BundleManifest.VERSIONS))
     for version in BundleManifest.VERSIONS:
         manifest = BundleManifest.from_path(
             os.path.join(
                 self.data_path, "bundle",
                 f"opensearch-bundle-schema-version-{version}.yml"))
         self.assertEqual(version, manifest.version)
 def setUp(self) -> None:
     os.chdir(os.path.dirname(__file__))
     self.bundle_manifest = BundleManifest.from_path(self.BUNDLE_MANIFEST)
     self.build_manifest = BuildManifest.from_path(self.BUILD_MANIFEST)
     self.test_manifest = TestManifest.from_path(self.TEST_MANIFEST)
     self.work_dir = Path("test_dir")
     self.test_recorder = MagicMock()
     self.save_logs = MagicMock()
     self.test_recorder.test_results_logs = self.save_logs
示例#6
0
 def setUp(self) -> None:
     self.manifest = BundleManifest.from_path(self.BUNDLE_MANIFEST)
     self.stack_name = "stack"
     self.config = {
         "Constants": {
             "SecurityGroupId": "sg-00000000",
             "VpcId": "vpc-12345",
             "AccountId": "12345678",
             "Region": "us-west-2",
             "Role": "role-arn"
         }
     }
示例#7
0
 def setUp(self):
     self.data_path = os.path.realpath(
         os.path.join(os.path.dirname(__file__), "data"))
     self.manifest_filename = os.path.join(self.data_path,
                                           "bundle_manifest.yml")
     self.manifest = BundleManifest.from_path(self.manifest_filename)
     self.endpoint = None
     self.perf_test_suite = PerfTestSuite(
         bundle_manifest=self.manifest,
         endpoint=None,
         security=False,
         current_workspace="current_workspace")
 def test_install_build_dependencies_local(self, mock_request, mock_copyfile, mock_makedirs):
     dependency_installer = DependencyInstallerOpenSearch(
         self.DATA,
         BuildManifest.from_path(self.BUILD_MANIFEST),
         BundleManifest.from_path(self.DIST_MANIFEST_LOCAL)
     )
     dependencies = dict({"opensearch-job-scheduler": "1.1.0.0"})
     dependency_installer.install_build_dependencies(dependencies, os.path.dirname(__file__))
     mock_makedirs.assert_called_with(os.path.dirname(__file__), exist_ok=True)
     mock_request.assert_not_called()
     mock_copyfile.assert_called_once_with(
         os.path.join(self.DATA, "builds", "opensearch", "plugins", "opensearch-job-scheduler-1.1.0.0.zip"),
         os.path.realpath(os.path.join(os.path.dirname(__file__), "opensearch-job-scheduler-1.1.0.0.zip")),
     )
    def test_install_maven_dependencies_remote_failure(self, mock_request, mock_copyfile, mock_makedirs):
        def mock_retrieve(source, dest):
            raise HTTPError(url=source, hdrs={}, fp=None, msg="Not Found", code=404)

        mock_request.side_effect = mock_retrieve

        dependency_installer = DependencyInstallerOpenSearch(
            "https://ci.opensearch.org/x/y",
            BuildManifest.from_path(self.BUILD_MANIFEST),
            BundleManifest.from_path(self.DIST_MANIFEST_REMOTE)
        )

        with self.assertRaises(HTTPError) as ctx:
            dependency_installer.install_maven_dependencies()
        self.assertEqual(str(ctx.exception), "HTTP Error 404: Not Found")
 def setUp(self):
     self.manifest = BundleManifest.from_path(self.BUNDLE_MANIFEST)
     self.stack_name = "stack"
     self.security = "disable"
     config = {
         "Constants": {
             "SecurityGroupId": "sg-00000000",
             "VpcId": "vpc-12345",
             "AccountId": "12345678",
             "Region": "us-west-2",
             "Role": "role-arn"
         }
     }
     self.perf_test_cluster = PerfTestCluster(
         bundle_manifest=self.manifest,
         config=config,
         stack_name=self.stack_name,
         security=self.security,
         current_workspace="current_workspace")
示例#11
0
 def test_install_build_dependencies_remote(self, mock_request: Mock,
                                            mock_copyfile: Mock,
                                            mock_makedirs: Mock) -> None:
     dependency_installer = DependencyInstallerOpenSearch(
         "https://ci.opensearch.org/x/y",
         BuildManifest.from_path(self.BUILD_MANIFEST),
         BundleManifest.from_path(self.DIST_MANIFEST_REMOTE))
     dependencies = dict({"opensearch-job-scheduler": "1.1.0.0"})
     dependency_installer.install_build_dependencies(
         dependencies, os.path.dirname(__file__))
     mock_makedirs.assert_called_with(os.path.dirname(__file__),
                                      exist_ok=True)
     mock_copyfile.assert_not_called()
     mock_request.assert_called_once_with(
         "https://ci.opensearch.org/x/y/builds/opensearch/plugins/opensearch-job-scheduler-1.1.0.0.zip",
         os.path.realpath(
             os.path.join(os.path.dirname(__file__),
                          "opensearch-job-scheduler-1.1.0.0.zip")),
     )
    def setUp(self) -> None:
        self.args = Mock()
        self.args.workload = "nyc_taxis"
        self.args.workload_options = "{}"
        self.args.warmup_iters = 0
        self.args.test_iters = 1
        self.data_path = os.path.realpath(
            os.path.join(os.path.dirname(__file__), "data"))
        self.manifest_filename = os.path.join(self.data_path,
                                              "bundle_manifest.yml")
        self.manifest = BundleManifest.from_path(self.manifest_filename)
        self.endpoint = "abc.com"

        self.perf_test_suite = PerfTestSuite(
            bundle_manifest=self.manifest,
            endpoint=self.endpoint,
            security=False,
            current_workspace="current_workspace",
            test_results_path="test/results/",
            args=self.args)
示例#13
0
 def setUp(self):
     os.chdir(os.path.dirname(__file__))
     self.bundle_manifest = BundleManifest.from_path(self.BUNDLE_MANIFEST)
     self.build_manifest = BuildManifest.from_path(self.BUILD_MANIFEST)
     self.test_manifest = TestManifest.from_path(self.TEST_MANIFEST)
示例#14
0
    def setUp(self):
        os.chdir(os.path.dirname(__file__))

        self.manifest = BundleManifest.from_path(self.MANIFEST)
        self.bwc_test_suite = BwcTestSuite(manifest=self.manifest, work_dir=".", component=None, keep=False)