diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 79a2565b09..78631b68de 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -32,7 +32,7 @@ jobs: pipenv run flake8 . - name: Run Type Checker run: | - pipenv run mypy src/build_workflow tests/tests_build_workflow src/checkout_workflow tests/tests_checkout_workflow src/run_assemble.py tests/test_run_assemble.py src/assemble_workflow tests/tests_assemble_workflow src/manifests tests/tests_manifests src/paths tests/tests_paths src/system tests/tests_system + pipenv run mypy src/build_workflow tests/tests_build_workflow src/checkout_workflow tests/tests_checkout_workflow src/run_assemble.py tests/test_run_assemble.py src/assemble_workflow tests/tests_assemble_workflow src/manifests tests/tests_manifests src/paths tests/tests_paths src/system tests/tests_system src/ci_workflow tests/tests_ci_workflow - name: Run Tests with Coverage run: | pipenv run coverage run -m pytest --cov=./src --cov-report=xml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 75db1fbaf0..ea4dd110af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: mypy stages: [commit] name: mypy - entry: bash -c 'pipenv run mypy src/build_workflow tests/tests_build_workflow src/checkout_workflow tests/tests_checkout_workflow src/run_assemble.py tests/test_run_assemble.py src/assemble_workflow tests/tests_assemble_workflow src/manifests tests/tests_manifests src/paths tests/tests_paths src/system tests/tests_system' + entry: bash -c 'pipenv run mypy src/build_workflow tests/tests_build_workflow src/checkout_workflow tests/tests_checkout_workflow src/run_assemble.py tests/test_run_assemble.py src/assemble_workflow tests/tests_assemble_workflow src/manifests tests/tests_manifests src/paths tests/tests_paths src/system tests/tests_system src/ci_workflow tests/tests_ci_workflow' language: system - id: pytest stages: [commit] diff --git a/src/ci_workflow/ci_args.py b/src/ci_workflow/ci_args.py index 12cf0ded7a..4ad83d8df1 100644 --- a/src/ci_workflow/ci_args.py +++ b/src/ci_workflow/ci_args.py @@ -5,15 +5,16 @@ # compatible open source license. import argparse +import io import logging import sys class CiArgs: - manifest: str + manifest: io.TextIOWrapper snapshot: bool - def __init__(self): + def __init__(self) -> None: parser = argparse.ArgumentParser(description="Sanity test the OpenSearch Bundle") parser.add_argument("manifest", type=argparse.FileType("r"), help="Manifest file.") parser.add_argument( @@ -47,7 +48,7 @@ def __init__(self): self.logging_level = args.logging_level self.script_path = sys.argv[0].replace("/src/run_ci.py", "/ci.sh") - def component_command(self, name): + def component_command(self, name: str) -> str: return " ".join( filter( None, diff --git a/src/ci_workflow/ci_check.py b/src/ci_workflow/ci_check.py index cc08bf3b25..80df30c4be 100644 --- a/src/ci_workflow/ci_check.py +++ b/src/ci_workflow/ci_check.py @@ -5,16 +5,21 @@ # compatible open source license. from abc import ABC, abstractmethod +from typing import Any + +from ci_workflow.ci_target import CiTarget +from git.git_repository import GitRepository +from manifests.input_manifest import Component class CiCheck(ABC): - def __init__(self, component, target, args=None): + def __init__(self, component: Any, target: CiTarget, args: Any = None) -> None: self.component = component self.target = target self.args = args @abstractmethod - def check(self): + def check(self) -> None: pass @@ -23,6 +28,6 @@ class CiCheckDist(CiCheck): class CiCheckSource(CiCheck): - def __init__(self, component, git_repo, target, args=None): + def __init__(self, component: Component, git_repo: GitRepository, target: CiTarget, args: Any = None) -> None: super().__init__(component, target, args) self.git_repo = git_repo diff --git a/src/ci_workflow/ci_check_gradle_dependencies.py b/src/ci_workflow/ci_check_gradle_dependencies.py index 211b0b9d8c..8a7e85356c 100644 --- a/src/ci_workflow/ci_check_gradle_dependencies.py +++ b/src/ci_workflow/ci_check_gradle_dependencies.py @@ -6,18 +6,22 @@ import logging import re +from typing import Any from ci_workflow.ci_check import CiCheckSource +from ci_workflow.ci_target import CiTarget +from git.git_repository import GitRepository +from manifests.input_manifest import InputComponent from system.properties_file import PropertiesFile class CiCheckGradleDependencies(CiCheckSource): - def __init__(self, component, git_repo, target, args): + def __init__(self, component: InputComponent, git_repo: GitRepository, target: CiTarget, args: Any) -> None: super().__init__(component, git_repo, target, args) self.gradle_project = args if args else None self.dependencies = self.__get_dependencies() - def __get_dependencies(self): + def __get_dependencies(self) -> PropertiesFile: cmd = " ".join( [ f"./gradlew {self.gradle_project or ''}:dependencies", diff --git a/src/ci_workflow/ci_check_gradle_dependencies_opensearch.py b/src/ci_workflow/ci_check_gradle_dependencies_opensearch.py index e34af96d39..69d1c7090a 100644 --- a/src/ci_workflow/ci_check_gradle_dependencies_opensearch.py +++ b/src/ci_workflow/ci_check_gradle_dependencies_opensearch.py @@ -10,6 +10,6 @@ class CiCheckGradleDependenciesOpenSearchVersion(CiCheckGradleDependencies): - def check(self): + def check(self) -> None: self.dependencies.check_value("org.opensearch:opensearch", self.target.opensearch_version) logging.info(f"Checked {self.component.name} OpenSearch dependency ({self.target.opensearch_version}).") diff --git a/src/ci_workflow/ci_check_gradle_properties.py b/src/ci_workflow/ci_check_gradle_properties.py index a1404e6cc9..1ae965d233 100644 --- a/src/ci_workflow/ci_check_gradle_properties.py +++ b/src/ci_workflow/ci_check_gradle_properties.py @@ -4,16 +4,21 @@ # this file be licensed under the Apache-2.0 license or a # compatible open source license. +from typing import Any + from ci_workflow.ci_check import CiCheckSource +from ci_workflow.ci_target import CiTarget +from git.git_repository import GitRepository +from manifests.input_manifest import Component from system.properties_file import PropertiesFile class CiCheckGradleProperties(CiCheckSource): - def __init__(self, component, git_repo, target, args=None): + def __init__(self, component: Component, git_repo: GitRepository, target: CiTarget, args: Any = None) -> None: super().__init__(component, git_repo, target, args) self.properties = self.__get_properties() - def __get_properties(self): + def __get_properties(self) -> PropertiesFile: cmd = " ".join( [ "./gradlew properties", diff --git a/src/ci_workflow/ci_check_gradle_properties_version.py b/src/ci_workflow/ci_check_gradle_properties_version.py index ad8ce40815..7ab73f9922 100644 --- a/src/ci_workflow/ci_check_gradle_properties_version.py +++ b/src/ci_workflow/ci_check_gradle_properties_version.py @@ -11,12 +11,12 @@ class CiCheckGradlePropertiesVersion(CiCheckGradleProperties): @property - def checked_version(self): + def checked_version(self) -> str: if self.component.name == "OpenSearch": return self.target.opensearch_version else: return self.target.component_version - def check(self): + def check(self) -> None: self.properties.check_value("version", self.checked_version) logging.info(f"Checked {self.component.name} ({self.checked_version}).") diff --git a/src/ci_workflow/ci_check_gradle_publish_to_maven_local.py b/src/ci_workflow/ci_check_gradle_publish_to_maven_local.py index 370db829ec..579c01fe39 100644 --- a/src/ci_workflow/ci_check_gradle_publish_to_maven_local.py +++ b/src/ci_workflow/ci_check_gradle_publish_to_maven_local.py @@ -8,7 +8,7 @@ class CiCheckGradlePublishToMavenLocal(CiCheckSource): - def check(self): + def check(self) -> None: cmd = " ".join( [ "./gradlew publishToMavenLocal", diff --git a/src/ci_workflow/ci_check_list.py b/src/ci_workflow/ci_check_list.py index 3623bb01a9..72e2aa6422 100644 --- a/src/ci_workflow/ci_check_list.py +++ b/src/ci_workflow/ci_check_list.py @@ -5,17 +5,20 @@ # compatible open source license. from abc import ABC, abstractmethod +from typing import Any + +from ci_workflow.ci_target import CiTarget class CiCheckList(ABC): - def __init__(self, component, target): + def __init__(self, component: Any, target: CiTarget) -> None: self.component = component self.target = target @abstractmethod - def checkout(self, work_dir): + def checkout(self, work_dir: str) -> None: pass @abstractmethod - def check(self): + def check(self) -> None: pass diff --git a/src/ci_workflow/ci_check_list_dist.py b/src/ci_workflow/ci_check_list_dist.py index a3499d56f0..56e1a1fb69 100644 --- a/src/ci_workflow/ci_check_list_dist.py +++ b/src/ci_workflow/ci_check_list_dist.py @@ -4,22 +4,24 @@ # this file be licensed under the Apache-2.0 license or a # compatible open source license. +from typing import Any + from ci_workflow.ci_check_list import CiCheckList from ci_workflow.ci_check_manifest_component import CiCheckManifestComponent class CiCheckListDist(CiCheckList): - def checkout(self, work_dir): + def checkout(self, work_dir: str) -> None: pass CHECKS = {"manifest:component": CiCheckManifestComponent} class InvalidCheckError(Exception): - def __init__(self, check): + def __init__(self, check: Any) -> None: self.check = check super().__init__(f"Invalid check: {check.name}, must be one of {CiCheckListDist.CHECKS.keys()}.") - def check(self): + def check(self) -> None: for check in self.component.checks: klass = CiCheckListDist.CHECKS.get(check.name, None) if klass is None: diff --git a/src/ci_workflow/ci_check_list_source.py b/src/ci_workflow/ci_check_list_source.py index 95c152f7a2..1d9467aba5 100644 --- a/src/ci_workflow/ci_check_list_source.py +++ b/src/ci_workflow/ci_check_list_source.py @@ -5,6 +5,7 @@ # compatible open source license. import os +from typing import Any from ci_workflow.ci_check_gradle_dependencies_opensearch import CiCheckGradleDependenciesOpenSearchVersion from ci_workflow.ci_check_gradle_properties_version import CiCheckGradlePropertiesVersion @@ -15,7 +16,7 @@ class CiCheckListSource(CiCheckList): - def checkout(self, work_dir): + def checkout(self, work_dir: str) -> None: self.git_repo = GitRepository( self.component.repository, self.component.ref, os.path.join(work_dir, self.component.name), self.component.working_directory ) @@ -30,11 +31,11 @@ def checkout(self, work_dir): } class InvalidCheckError(Exception): - def __init__(self, check): + def __init__(self, check: Any): self.check = check super().__init__(f"Invalid check: {check.name}, must be one of {CiCheckListSource.CHECKS.keys()}.") - def check(self): + def check(self) -> None: for check in self.component.checks: klass = CiCheckListSource.CHECKS.get(check.name, None) if klass is None: diff --git a/src/ci_workflow/ci_check_list_source_ref.py b/src/ci_workflow/ci_check_list_source_ref.py index 8fe51a4ff8..782ffc7975 100644 --- a/src/ci_workflow/ci_check_list_source_ref.py +++ b/src/ci_workflow/ci_check_list_source_ref.py @@ -15,10 +15,10 @@ class MissingRefError(Exception): def __init__(self, url: str, ref: str) -> None: super().__init__(f"Missing {url}@{ref}.") - def checkout(self, work_dir): + def checkout(self, work_dir: str) -> None: return super().checkout(work_dir) - def check(self): + def check(self) -> None: logging.info(f"Checking {self.component.repository} at {self.component.ref}.") results = subprocess.check_output(f"git ls-remote {self.component.repository} {self.component.ref}", shell=True).decode().strip().split("\t") if len(results) != 2: diff --git a/src/ci_workflow/ci_check_lists.py b/src/ci_workflow/ci_check_lists.py index 90c2dfd7df..86661b074d 100644 --- a/src/ci_workflow/ci_check_lists.py +++ b/src/ci_workflow/ci_check_lists.py @@ -5,16 +5,18 @@ # compatible open source license. from abc import ABC +from typing import Any from ci_workflow.ci_check_list_dist import CiCheckListDist from ci_workflow.ci_check_list_source import CiCheckListSource from ci_workflow.ci_check_list_source_ref import CiCheckListSourceRef +from ci_workflow.ci_target import CiTarget from manifests.input_manifest import InputComponentFromDist, InputComponentFromSource class CiCheckLists(ABC): @classmethod - def from_component(self, component, target): + def from_component(self, component: Any, target: CiTarget) -> Any: if type(component) is InputComponentFromDist: return CiCheckListDist(component, target) elif type(component) is InputComponentFromSource: diff --git a/src/ci_workflow/ci_check_manifest_component.py b/src/ci_workflow/ci_check_manifest_component.py index 15a71c08fb..a956edd832 100644 --- a/src/ci_workflow/ci_check_manifest_component.py +++ b/src/ci_workflow/ci_check_manifest_component.py @@ -14,10 +14,10 @@ class CiCheckManifestComponent(CiCheckDist): class MissingComponentError(Exception): - def __init__(self, component, url): + def __init__(self, component: str, url: str) -> None: super().__init__(f"Missing {component} in {url}.") - def check(self): + def check(self) -> None: for architecture in BuildArgs.SUPPORTED_ARCHITECTURES: # Since we only have 'linux' builds now we hard code it to 'linux' # Once we have all platform builds on S3 we can then add a second loop for 'BuildArgs.SUPPORTED_PLATFORMS' diff --git a/src/ci_workflow/ci_check_npm_package_version.py b/src/ci_workflow/ci_check_npm_package_version.py index 2af28d50c8..f7742ea6bd 100644 --- a/src/ci_workflow/ci_check_npm_package_version.py +++ b/src/ci_workflow/ci_check_npm_package_version.py @@ -11,12 +11,12 @@ class CiCheckNpmPackageVersion(CiCheckPackage): @property - def checked_version(self): + def checked_version(self) -> str: if self.component.name == "OpenSearch-Dashboards": - return self.target.opensearch_version.replace('-SNAPSHOT', '') + return self.target.opensearch_version.replace("-SNAPSHOT", "") else: - return self.target.component_version.replace('-SNAPSHOT', '') + return self.target.component_version.replace("-SNAPSHOT", "") - def check(self): + def check(self) -> None: self.properties.check_value("version", self.checked_version) logging.info(f"Checked {self.component.name} ({self.checked_version}).") diff --git a/src/ci_workflow/ci_check_package.py b/src/ci_workflow/ci_check_package.py index 1d2a3ded09..12adcc4ef9 100644 --- a/src/ci_workflow/ci_check_package.py +++ b/src/ci_workflow/ci_check_package.py @@ -6,27 +6,31 @@ import json import os +from typing import Any from ci_workflow.ci_check import CiCheckSource +from ci_workflow.ci_target import CiTarget +from git.git_repository import GitRepository +from manifests.input_manifest import Component from system.properties_file import PropertiesFile class CiCheckPackage(CiCheckSource): - def __init__(self, component, git_repo, target, args=None): + def __init__(self, component: Component, git_repo: GitRepository, target: CiTarget, args: Any = None) -> None: super().__init__(component, git_repo, target, args) self.properties = self.__get_properties() @property - def package_json_path(self): + def package_json_path(self) -> str: return os.path.join(self.git_repo.working_directory, "package.json") - def __get_properties(self): + def __get_properties(self) -> PropertiesFile: with open(self.package_json_path, "r") as f: return PropertiesFile(CiCheckPackage.__flattenDict(json.load(f))) # https://gist.github.com/higarmi/6708779 @classmethod - def __flattenDict(cls, d, result=None, index=None, parent_key=None): + def __flattenDict(cls, d: dict, result: dict = None, index: int = None, parent_key: str = None) -> dict: if result is None: result = {} if isinstance(d, (list, tuple)): diff --git a/src/ci_workflow/ci_input_manifest.py b/src/ci_workflow/ci_input_manifest.py index 6f6ffe2cc2..d09c4c360e 100644 --- a/src/ci_workflow/ci_input_manifest.py +++ b/src/ci_workflow/ci_input_manifest.py @@ -5,7 +5,9 @@ # compatible open source license. import logging +from io import TextIOWrapper +from ci_workflow.ci_args import CiArgs from ci_workflow.ci_check_lists import CiCheckLists from ci_workflow.ci_manifest import CiManifest from ci_workflow.ci_target import CiTarget @@ -14,10 +16,10 @@ class CiInputManifest(CiManifest): - def __init__(self, file, args): + def __init__(self, file: TextIOWrapper, args: CiArgs) -> None: super().__init__(InputManifest.from_file(file), args) - def __check__(self): + def __check__(self) -> None: target = CiTarget(version=self.manifest.build.version, name=self.manifest.build.filename, snapshot=self.args.snapshot) diff --git a/src/ci_workflow/ci_manifest.py b/src/ci_workflow/ci_manifest.py index 66e5e1e9e2..cdcbb35e34 100644 --- a/src/ci_workflow/ci_manifest.py +++ b/src/ci_workflow/ci_manifest.py @@ -4,18 +4,25 @@ # this file be licensed under the Apache-2.0 license or a # compatible open source license. -import abc import logging +from abc import ABC, abstractmethod +from typing import Any +from ci_workflow.ci_args import CiArgs -class CiManifest(abc.ABC): - def __init__(self, manifest, args): + +class CiManifest(ABC): + def __init__(self, manifest: Any, args: CiArgs) -> None: self.manifest = manifest self.args = args - def check(self): + def check(self) -> None: try: self.__check__() except: logging.error("CI Manifest check failed") raise + + @abstractmethod + def __check__(self) -> None: + pass diff --git a/src/ci_workflow/ci_manifests.py b/src/ci_workflow/ci_manifests.py index e7c59ea04e..e9f79d77e7 100644 --- a/src/ci_workflow/ci_manifests.py +++ b/src/ci_workflow/ci_manifests.py @@ -6,18 +6,22 @@ import re +from io import TextIOWrapper +from typing import Any +from ci_workflow.ci_args import CiArgs from ci_workflow.ci_input_manifest import CiInputManifest from ci_workflow.ci_test_manifest import CiTestManifest class CiManifests: - def __klass(filename): + @staticmethod + def __klass(filename: str) -> Any: if re.search("-test.yml$", filename): return CiTestManifest else: return CiInputManifest @classmethod - def from_file(cls, file, args): + def from_file(cls, file: TextIOWrapper, args: CiArgs) -> Any: return cls.__klass(file.name)(file, args) diff --git a/src/ci_workflow/ci_target.py b/src/ci_workflow/ci_target.py index 7aa76a61dc..2ae7f709e8 100644 --- a/src/ci_workflow/ci_target.py +++ b/src/ci_workflow/ci_target.py @@ -10,16 +10,16 @@ class CiTarget: name: str snapshot: bool - def __init__(self, version, name, snapshot=True): + def __init__(self, version: str, name: str, snapshot: bool = True) -> None: self.version = version self.name = name self.snapshot = snapshot @property - def opensearch_version(self): + def opensearch_version(self) -> str: return self.version + "-SNAPSHOT" if self.snapshot else self.version @property - def component_version(self): + def component_version(self) -> str: # BUG: the 4th digit is dictated by the component, it's not .0, this will break for 1.1.0.1 return self.version + ".0-SNAPSHOT" if self.snapshot else f"{self.version}.0" diff --git a/src/ci_workflow/ci_test_manifest.py b/src/ci_workflow/ci_test_manifest.py index 146e8f16e0..4b5d5603f2 100644 --- a/src/ci_workflow/ci_test_manifest.py +++ b/src/ci_workflow/ci_test_manifest.py @@ -6,16 +6,18 @@ import logging +from io import TextIOWrapper +from ci_workflow.ci_args import CiArgs from ci_workflow.ci_manifest import CiManifest from manifests.test_manifest import TestManifest class CiTestManifest(CiManifest): - def __init__(self, file, args): + def __init__(self, file: TextIOWrapper, args: CiArgs) -> None: super().__init__(TestManifest.from_file(file), args) - def __check__(self): + def __check__(self) -> None: assert self.manifest logging.info("TestManifest schema validation succeeded") logging.info("Done.") diff --git a/tests/tests_ci_workflow/test_ci_args.py b/tests/tests_ci_workflow/test_ci_args.py index 275a4fd9c0..aba6121468 100644 --- a/tests/tests_ci_workflow/test_ci_args.py +++ b/tests/tests_ci_workflow/test_ci_args.py @@ -29,46 +29,46 @@ class TestCiArgs(unittest.TestCase): ) @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST]) - def test_manifest(self): + def test_manifest(self) -> None: self.assertEqual(CiArgs().manifest.name, TestCiArgs.OPENSEARCH_MANIFEST) @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST]) - def test_keep_default(self): + def test_keep_default(self) -> None: self.assertFalse(CiArgs().keep) @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST, "--keep"]) - def test_keep_true(self): + def test_keep_true(self) -> None: self.assertTrue(CiArgs().keep) @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST]) - def test_snapshot_default(self): + def test_snapshot_default(self) -> None: self.assertFalse(CiArgs().snapshot) @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST, "--snapshot"]) - def test_snapshot_true(self): + def test_snapshot_true(self) -> None: self.assertTrue(CiArgs().snapshot) @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST]) - def test_component_default(self): + def test_component_default(self) -> None: self.assertIsNone(CiArgs().component) @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST, "--component", "xyz"]) - def test_component(self): + def test_component(self) -> None: self.assertEqual(CiArgs().component, "xyz") @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST, "--component", "xyz"]) - def test_script_path(self): + def test_script_path(self) -> None: self.assertEqual(CiArgs().script_path, self.CI_SH) @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST]) - def test_component_command(self): + def test_component_command(self) -> None: self.assertEqual( CiArgs().component_command("component"), f"{self.CI_SH} {self.OPENSEARCH_MANIFEST} --component component", ) @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST, "--snapshot"]) - def test_component_command_with_snapshot(self): + def test_component_command_with_snapshot(self) -> None: self.assertEqual( CiArgs().component_command("component"), f"{self.CI_SH} {self.OPENSEARCH_MANIFEST} --component component --snapshot", diff --git a/tests/tests_ci_workflow/test_ci_check_gradle_dependencies.py b/tests/tests_ci_workflow/test_ci_check_gradle_dependencies.py index 80fb89642b..e49b421adb 100644 --- a/tests/tests_ci_workflow/test_ci_check_gradle_dependencies.py +++ b/tests/tests_ci_workflow/test_ci_check_gradle_dependencies.py @@ -6,6 +6,7 @@ import os import unittest +from typing import Any from unittest.mock import MagicMock from ci_workflow.ci_check_gradle_dependencies import CiCheckGradleDependencies @@ -14,10 +15,10 @@ class TestCiCheckGradleDependencies(unittest.TestCase): class DummyDependencies(CiCheckGradleDependencies): - def check(self): + def check(self) -> None: pass - def __mock_dependencies(self, props="", snapshot=False, gradle_project=None): + def __mock_dependencies(self, props: str = "", snapshot: bool = False, gradle_project: Any = None) -> DummyDependencies: git_repo = MagicMock() git_repo.output.return_value = props @@ -28,25 +29,26 @@ def __mock_dependencies(self, props="", snapshot=False, gradle_project=None): args=gradle_project, ) - def test_executes_gradle_dependencies(self): + def test_executes_gradle_dependencies(self) -> None: check = self.__mock_dependencies() - check.git_repo.output.assert_called_once_with( - './gradlew :dependencies -Dopensearch.version=1.1.0 -Dbuild.snapshot=false --configuration compileOnly | grep -e "---"' - ) + output = unittest.mock.create_autospec(check.git_repo.output) + output.assert_called_once_with('./gradlew :dependencies -Dopensearch.version=1.1.0 -Dbuild.snapshot=false --configuration compileOnly | grep -e "---"') - def test_executes_gradle_dependencies_snapshot(self): + def test_executes_gradle_dependencies_snapshot(self) -> None: check = self.__mock_dependencies(snapshot=True) - check.git_repo.output.assert_called_once_with( + output = unittest.mock.create_autospec(check.git_repo.output) + output.assert_called_once_with( './gradlew :dependencies -Dopensearch.version=1.1.0-SNAPSHOT -Dbuild.snapshot=true --configuration compileOnly | grep -e "---"' ) - def test_executes_gradle_dependencies_project(self): + def test_executes_gradle_dependencies_project(self) -> None: check = self.__mock_dependencies(snapshot=True, gradle_project="project") - check.git_repo.output.assert_called_once_with( + output = unittest.mock.create_autospec(check.git_repo.output) + output.assert_called_once_with( './gradlew project:dependencies -Dopensearch.version=1.1.0-SNAPSHOT -Dbuild.snapshot=true --configuration compileOnly | grep -e "---"' ) - def test_loads_tree(self): + def test_loads_tree(self) -> None: data_path = os.path.join(os.path.dirname(__file__), "data", "job_scheduler_dependencies.txt") with open(data_path) as f: check = self.__mock_dependencies(props=f.read()) diff --git a/tests/tests_ci_workflow/test_ci_check_gradle_dependencies_opensearch.py b/tests/tests_ci_workflow/test_ci_check_gradle_dependencies_opensearch.py index 6d7b94d5aa..3d202e2f81 100644 --- a/tests/tests_ci_workflow/test_ci_check_gradle_dependencies_opensearch.py +++ b/tests/tests_ci_workflow/test_ci_check_gradle_dependencies_opensearch.py @@ -5,6 +5,7 @@ # compatible open source license. import unittest +from typing import Any from unittest.mock import MagicMock, patch from ci_workflow.ci_check_gradle_dependencies_opensearch import CiCheckGradleDependenciesOpenSearchVersion @@ -13,7 +14,7 @@ class TestCiCheckGradleDependenciesOpenSearchVersion(unittest.TestCase): - def __mock_check(self, props=None): + def __mock_check(self, props: Any = None) -> CiCheckGradleDependenciesOpenSearchVersion: with patch.object( CiCheckGradleDependenciesOpenSearchVersion, "_CiCheckGradleDependencies__get_dependencies", @@ -26,13 +27,13 @@ def __mock_check(self, props=None): args=None, ) - def test_gradle_project(self): + def test_gradle_project(self) -> None: self.assertIsNone(self.__mock_check().gradle_project) - def test_has_version(self): + def test_has_version(self) -> None: self.__mock_check({"org.opensearch:opensearch": "1.1.0-SNAPSHOT"}).check() - def test_missing_version(self): + def test_missing_version(self) -> None: with self.assertRaises(PropertiesFile.UnexpectedKeyValueError) as err: self.__mock_check({}).check() self.assertEqual( @@ -40,7 +41,7 @@ def test_missing_version(self): "Expected to have org.opensearch:opensearch='1.1.0-SNAPSHOT', but none was found.", ) - def test_invalid_version(self): + def test_invalid_version(self) -> None: with self.assertRaises(PropertiesFile.UnexpectedKeyValueError) as err: self.__mock_check({"org.opensearch:opensearch": "1.2.0-SNAPSHOT"}).check() self.assertEqual( @@ -48,24 +49,26 @@ def test_invalid_version(self): "Expected to have org.opensearch:opensearch='1.1.0-SNAPSHOT', but was '1.2.0-SNAPSHOT'.", ) - def test_executes_gradle_command(self): + def test_executes_gradle_command(self) -> None: check = CiCheckGradleDependenciesOpenSearchVersion( component=MagicMock(), git_repo=MagicMock(), target=CiTarget(version="1.1.0", name="opensearch", snapshot=True), args=None, ) - check.git_repo.output.assert_called_once_with( + output = unittest.mock.create_autospec(check.git_repo.output) + output.assert_called_once_with( './gradlew :dependencies -Dopensearch.version=1.1.0-SNAPSHOT -Dbuild.snapshot=true --configuration compileOnly | grep -e "---"' ) - def test_executes_gradle_command_with_arg(self): + def test_executes_gradle_command_with_arg(self) -> None: check = CiCheckGradleDependenciesOpenSearchVersion( component=MagicMock(), git_repo=MagicMock(), target=CiTarget(version="1.1.0", name="opensearch", snapshot=True), args="plugin", ) - check.git_repo.output.assert_called_once_with( + output = unittest.mock.create_autospec(check.git_repo.output) + output.assert_called_once_with( './gradlew plugin:dependencies -Dopensearch.version=1.1.0-SNAPSHOT -Dbuild.snapshot=true --configuration compileOnly | grep -e "---"' ) diff --git a/tests/tests_ci_workflow/test_ci_check_gradle_properties.py b/tests/tests_ci_workflow/test_ci_check_gradle_properties.py index 6acafa2aca..8e4d5ba9bb 100644 --- a/tests/tests_ci_workflow/test_ci_check_gradle_properties.py +++ b/tests/tests_ci_workflow/test_ci_check_gradle_properties.py @@ -13,10 +13,10 @@ class TestCiCheckGradleProperties(unittest.TestCase): class DummyProperties(CiCheckGradleProperties): - def check(self): + def check(self) -> None: pass - def test_executes_gradle_properties(self): + def test_executes_gradle_properties(self) -> None: git_repo = MagicMock() git_repo.output.return_value = "" @@ -28,7 +28,7 @@ def test_executes_gradle_properties(self): git_repo.output.assert_called_once_with("./gradlew properties -Dopensearch.version=1.1.0 -Dbuild.snapshot=false") - def test_executes_gradle_properties_snapshot(self): + def test_executes_gradle_properties_snapshot(self) -> None: git_repo = MagicMock() git_repo.output.return_value = "" diff --git a/tests/tests_ci_workflow/test_ci_check_gradle_properties_version.py b/tests/tests_ci_workflow/test_ci_check_gradle_properties_version.py index 225626ad35..7d55f1b942 100644 --- a/tests/tests_ci_workflow/test_ci_check_gradle_properties_version.py +++ b/tests/tests_ci_workflow/test_ci_check_gradle_properties_version.py @@ -5,6 +5,7 @@ # compatible open source license. import unittest +from typing import Any from unittest.mock import MagicMock, patch from ci_workflow.ci_check_gradle_properties_version import CiCheckGradlePropertiesVersion @@ -14,7 +15,7 @@ class TestCiCheckGradlePropertiesVersion(unittest.TestCase): - def __mock_check(self, props=None, component=None, snapshot=True): + def __mock_check(self, props: Any = None, component: Component = None, snapshot: bool = True) -> CiCheckGradlePropertiesVersion: with patch.object(CiCheckGradlePropertiesVersion, "_CiCheckGradleProperties__get_properties") as mock_properties: mock_properties.return_value = PropertiesFile(props) return CiCheckGradlePropertiesVersion( @@ -23,10 +24,10 @@ def __mock_check(self, props=None, component=None, snapshot=True): target=CiTarget(version="1.1.0", name="opensearch", snapshot=snapshot), ) - def test_has_version(self): + def test_has_version(self) -> None: self.__mock_check({"version": "1.1.0.0-SNAPSHOT"}).check() - def test_missing_version(self): + def test_missing_version(self) -> None: with self.assertRaises(PropertiesFile.UnexpectedKeyValueError) as err: self.__mock_check().check() self.assertEqual( @@ -34,7 +35,7 @@ def test_missing_version(self): "Expected to have version='1.1.0.0-SNAPSHOT', but none was found.", ) - def test_invalid_version(self): + def test_invalid_version(self) -> None: with self.assertRaises(PropertiesFile.UnexpectedKeyValueError) as err: self.__mock_check({"version": "1.2.0-SNAPSHOT"}).check() self.assertEqual( @@ -42,7 +43,7 @@ def test_invalid_version(self): "Expected to have version='1.1.0.0-SNAPSHOT', but was '1.2.0-SNAPSHOT'.", ) - def test_component_version_opensearch(self): + def test_component_version_opensearch(self) -> None: check = self.__mock_check( props={"version": "1.1.0.0-SNAPSHOT"}, component=Component({"name": "OpenSearch", "repository": "", "ref": ""}), @@ -58,7 +59,7 @@ def test_component_version_opensearch(self): "Expected to have version='1.1.0-SNAPSHOT', but was '1.1.0.0-SNAPSHOT'.", ) - def test_component_version(self): + def test_component_version(self) -> None: check = self.__mock_check( props={"version": "1.1.0-SNAPSHOT"}, component=Component({"name": "Plugin", "repository": "", "ref": ""}), diff --git a/tests/tests_ci_workflow/test_ci_check_gradle_publish_to_maven_local.py b/tests/tests_ci_workflow/test_ci_check_gradle_publish_to_maven_local.py index ebd737d363..db9c97e144 100644 --- a/tests/tests_ci_workflow/test_ci_check_gradle_publish_to_maven_local.py +++ b/tests/tests_ci_workflow/test_ci_check_gradle_publish_to_maven_local.py @@ -12,20 +12,22 @@ class TestCiCheckGradlePublishToMavenLocal(unittest.TestCase): - def test_executes_gradle_command(self): + def test_executes_gradle_command(self) -> None: check = CiCheckGradlePublishToMavenLocal( component=MagicMock(), git_repo=MagicMock(), target=CiTarget(version="1.1.0", name="opensearch", snapshot=False), ) check.check() - check.git_repo.execute.assert_called_once_with("./gradlew publishToMavenLocal -Dopensearch.version=1.1.0 -Dbuild.snapshot=false") + exec_command = unittest.mock.create_autospec(check.git_repo.execute) + exec_command.assert_called_once_with("./gradlew publishToMavenLocal -Dopensearch.version=1.1.0 -Dbuild.snapshot=false") - def test_executes_gradle_command_snapshot(self): + def test_executes_gradle_command_snapshot(self) -> None: check = CiCheckGradlePublishToMavenLocal( component=MagicMock(), git_repo=MagicMock(), target=CiTarget(version="1.1.0", name="opensearch", snapshot=True), ) check.check() - check.git_repo.execute.assert_called_once_with("./gradlew publishToMavenLocal -Dopensearch.version=1.1.0-SNAPSHOT -Dbuild.snapshot=true") + exec_command = unittest.mock.create_autospec(check.git_repo.execute) + exec_command.assert_called_once_with("./gradlew publishToMavenLocal -Dopensearch.version=1.1.0-SNAPSHOT -Dbuild.snapshot=true") diff --git a/tests/tests_ci_workflow/test_ci_check_lists.py b/tests/tests_ci_workflow/test_ci_check_lists.py index 547105542f..60e0da1633 100644 --- a/tests/tests_ci_workflow/test_ci_check_lists.py +++ b/tests/tests_ci_workflow/test_ci_check_lists.py @@ -14,35 +14,21 @@ class TestCiCheckLists(unittest.TestCase): - def test_from_component_source(self): - check_list = CiCheckLists.from_component(InputComponentFromSource({ - "name": "common-utils", - "repository": "url", - "ref": "ref" - }), None) + def test_from_component_source(self) -> None: + check_list = CiCheckLists.from_component(InputComponentFromSource({"name": "common-utils", "repository": "url", "ref": "ref"}), None) self.assertIs(type(check_list), CiCheckListSourceRef) - def test_from_component_source_with_checks(self): + def test_from_component_source_with_checks(self) -> None: check_list = CiCheckLists.from_component( - InputComponentFromSource({ - "name": "common-utils", - "repository": "url", - "ref": "ref", - "checks": [ - "check1" - ] - }), None + InputComponentFromSource({"name": "common-utils", "repository": "url", "ref": "ref", "checks": ["check1"]}), None ) self.assertIs(type(check_list), CiCheckListSource) - def test_from_component_dist(self): - check_list = CiCheckLists.from_component(InputComponentFromDist({ - "name": "common-utils", - "dist": "url" - }), None) + def test_from_component_dist(self) -> None: + check_list = CiCheckLists.from_component(InputComponentFromDist({"name": "common-utils", "dist": "url"}), None) self.assertIs(type(check_list), CiCheckListDist) - def test_from_component_invalid(self): + def test_from_component_invalid(self) -> None: with self.assertRaises(ValueError) as ctx: CiCheckLists.from_component(self, None) self.assertTrue(str(ctx.exception).startswith("Invalid component type: ")) diff --git a/tests/tests_ci_workflow/test_ci_check_lists_dist.py b/tests/tests_ci_workflow/test_ci_check_lists_dist.py index 00b566d11e..542bf14ea9 100644 --- a/tests/tests_ci_workflow/test_ci_check_lists_dist.py +++ b/tests/tests_ci_workflow/test_ci_check_lists_dist.py @@ -20,24 +20,16 @@ class TestCiCheckListsDist(unittest.TestCase): @patch("manifests.distribution.find_build_root") @patch("manifests.build_manifest.BuildManifest.from_url") - def test_check(self, mock_manifest_from_url: Mock, find_build_root: Mock): + def test_check(self, mock_manifest_from_url: Mock, find_build_root: Mock) -> None: mock_manifest_from_url.return_value = BuildManifest.from_path(self.BUILD_MANIFEST) - component = InputComponentFromDist({ - "name": "common-utils", - "dist": "url", - "checks": ["manifest:component"] - }) + component = InputComponentFromDist({"name": "common-utils", "dist": "url", "checks": ["manifest:component"]}) list = CiCheckListDist(component, CiTarget(version="1.1.0", name="opensearch", snapshot=True)) list.check() mock_manifest_from_url.assert_called() find_build_root.assert_called() - def test_invalid_check(self, *mocks): - component = InputComponentFromDist({ - "name": "common-utils", - "dist": "url", - "checks": ["invalid:check"] - }) + def test_invalid_check(self, *mocks: Mock) -> None: + component = InputComponentFromDist({"name": "common-utils", "dist": "url", "checks": ["invalid:check"]}) list = CiCheckListDist(component, CiTarget(version="1.1.0", name="opensearch", snapshot=True)) list.checkout("path") with self.assertRaises(CiCheckListDist.InvalidCheckError) as ctx: diff --git a/tests/tests_ci_workflow/test_ci_check_lists_source.py b/tests/tests_ci_workflow/test_ci_check_lists_source.py index 6029440c36..5f248096f8 100644 --- a/tests/tests_ci_workflow/test_ci_check_lists_source.py +++ b/tests/tests_ci_workflow/test_ci_check_lists_source.py @@ -13,25 +13,16 @@ class TestCiCheckListsSource(unittest.TestCase): @patch("ci_workflow.ci_check_list_source.GitRepository") - def test_checkout(self, mock_git_repo): - component = InputComponentFromSource({ - "name": "common-utils", - "repository": "url", - "ref": "ref" - }) + def test_checkout(self, mock_git_repo: MagicMock) -> None: + component = InputComponentFromSource({"name": "common-utils", "repository": "url", "ref": "ref"}) list = CiCheckListSource(component, MagicMock()) list.checkout("path") mock_git_repo.assert_called() @patch("ci_workflow.ci_check_list_source.GitRepository") @patch("ci_workflow.ci_check_gradle_properties.PropertiesFile") - def test_check(self, mock_properties_file, mock_check, *mocks): - component = InputComponentFromSource({ - "name": "common-utils", - "repository": "url", - "ref": "ref", - "checks": ["gradle:properties:version"] - }) + def test_check(self, mock_properties_file: MagicMock, mock_check: MagicMock, *mocks: MagicMock) -> None: + component = InputComponentFromSource({"name": "common-utils", "repository": "url", "ref": "ref", "checks": ["gradle:properties:version"]}) list = CiCheckListSource(component, MagicMock()) list.checkout("path") list.check() @@ -40,13 +31,8 @@ def test_check(self, mock_properties_file, mock_check, *mocks): mock_properties_file.assert_called() @patch("ci_workflow.ci_check_list_source.GitRepository") - def test_invalid_check(self, *mocks): - component = InputComponentFromSource({ - "name": "common-utils", - "repository": "url", - "ref": "ref", - "checks": ["invalid:check"] - }) + def test_invalid_check(self, *mocks: MagicMock) -> None: + component = InputComponentFromSource({"name": "common-utils", "repository": "url", "ref": "ref", "checks": ["invalid:check"]}) list = CiCheckListSource(component, MagicMock()) list.checkout("path") with self.assertRaises(CiCheckListSource.InvalidCheckError) as ctx: diff --git a/tests/tests_ci_workflow/test_ci_check_lists_source_ref.py b/tests/tests_ci_workflow/test_ci_check_lists_source_ref.py index d635fb4cb7..2e14866cba 100644 --- a/tests/tests_ci_workflow/test_ci_check_lists_source_ref.py +++ b/tests/tests_ci_workflow/test_ci_check_lists_source_ref.py @@ -13,7 +13,7 @@ class TestCiCheckListsSourceRef(unittest.TestCase): @patch("subprocess.check_output", return_value="invalid".encode()) - def test_ref_does_not_exist(self, mock_check_output): + def test_ref_does_not_exist(self, mock_check_output: MagicMock) -> None: component = InputComponentFromSource({"name": "common-utils", "repository": "url", "ref": "ref"}) with self.assertRaises(CiCheckListSourceRef.MissingRefError) as ctx: list = CiCheckListSourceRef(component, MagicMock()) @@ -22,7 +22,7 @@ def test_ref_does_not_exist(self, mock_check_output): mock_check_output.assert_called_with("git ls-remote url ref", shell=True) @patch("subprocess.check_output", return_value="valid\tref".encode()) - def test_ref_exists(self, mock_check_output): + def test_ref_exists(self, mock_check_output: MagicMock) -> None: component = InputComponentFromSource({"name": "common-utils", "repository": "url", "ref": "ref"}) list = CiCheckListSourceRef(component, MagicMock()) list.check() diff --git a/tests/tests_ci_workflow/test_ci_check_manifest_component.py b/tests/tests_ci_workflow/test_ci_check_manifest_component.py index 40231a4e21..bf3bc32201 100644 --- a/tests/tests_ci_workflow/test_ci_check_manifest_component.py +++ b/tests/tests_ci_workflow/test_ci_check_manifest_component.py @@ -20,33 +20,35 @@ class TestCiCheckManifestComponent(unittest.TestCase): @patch("manifests.distribution.find_build_root") @patch("ci_workflow.ci_check_manifest_component.BuildManifest") - def test_retrieves_manifests(self, mock_manifest: Mock, find_build_root: Mock): - find_build_root.return_value = 'url/linux/ARCH/builds/opensearch' - check = CiCheckManifestComponent(InputComponentFromDist({ - "name": "common-utils", - "dist": "url" - }), CiTarget(version="1.1.0", name="opensearch", snapshot=True)) + def test_retrieves_manifests(self, mock_manifest: Mock, find_build_root: Mock) -> None: + find_build_root.return_value = "url/linux/ARCH/builds/opensearch" + check = CiCheckManifestComponent( + InputComponentFromDist({"name": "common-utils", "dist": "url"}), CiTarget(version="1.1.0", name="opensearch", snapshot=True) + ) mock_manifest.from_url.return_value = BuildManifest.from_path(self.BUILD_MANIFEST) check.check() - mock_manifest.from_url.assert_has_calls([ - call("url/linux/ARCH/builds/opensearch/manifest.yml"), - call("url/linux/ARCH/builds/opensearch/manifest.yml"), - ]) - find_build_root.assert_has_calls([ - call('url', 'linux', 'x64', 'opensearch'), - call('url', 'linux', 'arm64', 'opensearch'), - ]) + mock_manifest.from_url.assert_has_calls( + [ + call("url/linux/ARCH/builds/opensearch/manifest.yml"), + call("url/linux/ARCH/builds/opensearch/manifest.yml"), + ] + ) + find_build_root.assert_has_calls( + [ + call("url", "linux", "x64", "opensearch"), + call("url", "linux", "arm64", "opensearch"), + ] + ) @patch("manifests.distribution.find_build_root") @patch("ci_workflow.ci_check_manifest_component.BuildManifest") - def test_missing_component(self, mock_manifest: Mock, find_build_root: Mock): - find_build_root.return_value = 'url/linux/x64/builds/opensearch' - check = CiCheckManifestComponent(InputComponentFromDist({ - "name": "does-not-exist", - "dist": "url" - }), CiTarget(version="1.1.0", name="opensearch", snapshot=True)) + def test_missing_component(self, mock_manifest: Mock, find_build_root: Mock) -> None: + find_build_root.return_value = "url/linux/x64/builds/opensearch" + check = CiCheckManifestComponent( + InputComponentFromDist({"name": "does-not-exist", "dist": "url"}), CiTarget(version="1.1.0", name="opensearch", snapshot=True) + ) mock_manifest.from_url.return_value = BuildManifest.from_path(self.BUILD_MANIFEST) diff --git a/tests/tests_ci_workflow/test_ci_check_npm_package_version.py b/tests/tests_ci_workflow/test_ci_check_npm_package_version.py index 7fd2207923..2868abe6f6 100644 --- a/tests/tests_ci_workflow/test_ci_check_npm_package_version.py +++ b/tests/tests_ci_workflow/test_ci_check_npm_package_version.py @@ -5,6 +5,7 @@ # compatible open source license. import unittest +from typing import Any from unittest.mock import MagicMock, patch from ci_workflow.ci_check_npm_package_version import CiCheckNpmPackageVersion @@ -14,7 +15,7 @@ class TestCiCheckNpmPackageVersion(unittest.TestCase): - def __mock_check(self, props=None, component=None, snapshot=True): + def __mock_check(self, props: Any = None, component: Component = None, snapshot: bool = True) -> CiCheckNpmPackageVersion: with patch.object(CiCheckNpmPackageVersion, "_CiCheckPackage__get_properties") as mock_properties: mock_properties.return_value = PropertiesFile(props) return CiCheckNpmPackageVersion( @@ -23,10 +24,10 @@ def __mock_check(self, props=None, component=None, snapshot=True): target=CiTarget(version="1.1.0", name="dashboards-plugin", snapshot=snapshot), ) - def test_has_version(self): + def test_has_version(self) -> None: self.__mock_check({"version": "1.1.0.0"}).check() - def test_missing_version(self): + def test_missing_version(self) -> None: with self.assertRaises(PropertiesFile.UnexpectedKeyValueError) as err: self.__mock_check().check() self.assertEqual( @@ -34,7 +35,7 @@ def test_missing_version(self): "Expected to have version='1.1.0.0', but none was found.", ) - def test_invalid_version(self): + def test_invalid_version(self) -> None: with self.assertRaises(PropertiesFile.UnexpectedKeyValueError) as err: self.__mock_check({"version": "1.2.0"}, component=None, snapshot=False).check() self.assertEqual( @@ -42,7 +43,7 @@ def test_invalid_version(self): "Expected to have version='1.1.0.0', but was '1.2.0'.", ) - def test_invalid_version_snapshot(self): + def test_invalid_version_snapshot(self) -> None: with self.assertRaises(PropertiesFile.UnexpectedKeyValueError) as err: self.__mock_check({"version": "1.2.0"}, component=None, snapshot=True).check() self.assertEqual( @@ -50,7 +51,7 @@ def test_invalid_version_snapshot(self): "Expected to have version='1.1.0.0', but was '1.2.0'.", ) - def test_component_version_opensearch_dashboards(self): + def test_component_version_opensearch_dashboards(self) -> None: check = self.__mock_check( props={"version": "1.1.0.0"}, component=Component({"name": "OpenSearch-Dashboards", "repository": "", "ref": ""}), @@ -66,7 +67,7 @@ def test_component_version_opensearch_dashboards(self): "Expected to have version='1.1.0', but was '1.1.0.0'.", ) - def test_component_version(self): + def test_component_version(self) -> None: check = self.__mock_check( props={"version": "1.1.0"}, component=Component({"name": "Plugin", "repository": "", "ref": ""}), diff --git a/tests/tests_ci_workflow/test_ci_check_package.py b/tests/tests_ci_workflow/test_ci_check_package.py index 57dc0eec03..651348a590 100644 --- a/tests/tests_ci_workflow/test_ci_check_package.py +++ b/tests/tests_ci_workflow/test_ci_check_package.py @@ -16,10 +16,10 @@ class TestCiCheckPackage(unittest.TestCase): DATA = os.path.join(os.path.dirname(__file__), "data") class DummyProperties(CiCheckPackage): - def check(self): + def check(self) -> None: pass - def test_loads_package_json(self): + def test_loads_package_json(self) -> None: props = TestCiCheckPackage.DummyProperties( component=MagicMock(), git_repo=MagicMock(working_directory=self.DATA), diff --git a/tests/tests_ci_workflow/test_ci_target.py b/tests/tests_ci_workflow/test_ci_target.py index 710ed5d403..77dd9ae3f4 100644 --- a/tests/tests_ci_workflow/test_ci_target.py +++ b/tests/tests_ci_workflow/test_ci_target.py @@ -10,19 +10,19 @@ class TestCiTarget(unittest.TestCase): - def test_opensearch_version(self): + def test_opensearch_version(self) -> None: self.assertEqual(CiTarget(version="1.1.0", name="opensearch", snapshot=False).opensearch_version, "1.1.0") - def test_opensearch_version_snapshot(self): + def test_opensearch_version_snapshot(self) -> None: self.assertEqual( CiTarget(version="1.1.0", name="opensearch", snapshot=True).opensearch_version, "1.1.0-SNAPSHOT", ) - def test_component_version(self): + def test_component_version(self) -> None: self.assertEqual(CiTarget(version="1.1.0", name="opensearch", snapshot=False).component_version, "1.1.0.0") - def test_component_version_snapshot(self): + def test_component_version_snapshot(self) -> None: self.assertEqual( CiTarget(version="1.1.0", name="opensearch", snapshot=True).component_version, "1.1.0.0-SNAPSHOT",