Skip to content

Commit

Permalink
Change plugin check to be min version
Browse files Browse the repository at this point in the history
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla committed Mar 29, 2022
1 parent 39652f0 commit 98a1e87
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/build_workflow/build_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def opensearch_version(self) -> str:
)

@property
def compatible_core_versions(self) -> List[str]:
def compatible_min_versions(self) -> List[str]:
return (
[BuildTarget.__qualify_version(self.version, self.qualifier, self.snapshot)]
+ self.patches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def check(self, path: str) -> None:
try:
versions: List[Any] = [None]
versions.extend(self.target.compatible_component_versions)
versions.extend(self.target.compatible_core_versions)
versions.extend(self.target.compatible_min_versions)
properties.check_value_in("Implementation-Version", versions)
except PropertiesFile.CheckError as e:
raise BuildArtifactCheck.BuildArtifactInvalidError(path, str(e))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def check(self, path: str) -> None:
config = ConfigFile(data)
try:
config.check_value_in("version", self.target.compatible_opensearch_dashboards_component_versions)
config.check_value_in("opensearchDashboardsVersion", self.target.compatible_core_versions)
config.check_value_in("opensearchDashboardsVersion", self.target.compatible_min_versions)
except ConfigFile.CheckError as e:
raise BuildArtifactCheck.BuildArtifactInvalidError(path, e.__str__())
logging.info(f'Checked {path} ({config.get_value("version", "N/A")})')

def __valid_paths(self, pluginName: str) -> List[str]:
return list(map(lambda version: f"{pluginName}-{version}.zip", self.target.compatible_core_versions))
return list(map(lambda version: f"{pluginName}-{version}.zip", self.target.compatible_min_versions))
16 changes: 8 additions & 8 deletions tests/tests_build_workflow/test_build_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,27 @@ def test_opensearch_version_snapshot_qualifier(self) -> None:
"1.1.0-alpha1-SNAPSHOT",
)

def test_compatible_core_versions(self) -> None:
def test_compatible_min_versions(self) -> None:
self.assertEqual(
BuildTarget(version="1.1.2", architecture="x86", patches=["1.1.0", "1.1.1"], snapshot=False).compatible_core_versions,
BuildTarget(version="1.1.2", architecture="x86", patches=["1.1.0", "1.1.1"], snapshot=False).compatible_min_versions,
['1.1.2', '1.1.0', '1.1.1', '1.1.0-SNAPSHOT', '1.1.1-SNAPSHOT'],
)

def test_compatible_core_versions_qualifier(self) -> None:
def test_compatible_min_versions_qualifier(self) -> None:
self.assertEqual(
BuildTarget(version="1.1.2", architecture="x86", patches=["1.1.0", "1.1.1"], snapshot=False, qualifier="alpha1").compatible_core_versions,
BuildTarget(version="1.1.2", architecture="x86", patches=["1.1.0", "1.1.1"], snapshot=False, qualifier="alpha1").compatible_min_versions,
['1.1.2-alpha1', '1.1.0', '1.1.1', '1.1.0-alpha1-SNAPSHOT', '1.1.1-alpha1-SNAPSHOT'],
)

def test_compatible_core_versions_snapshot(self) -> None:
def test_compatible_min_versions_snapshot(self) -> None:
self.assertEqual(
BuildTarget(version="1.1.2", architecture="x86", patches=["1.1.0", "1.1.1"], snapshot=True).compatible_core_versions,
BuildTarget(version="1.1.2", architecture="x86", patches=["1.1.0", "1.1.1"], snapshot=True).compatible_min_versions,
['1.1.2-SNAPSHOT', '1.1.0', '1.1.1', '1.1.0-SNAPSHOT', '1.1.1-SNAPSHOT'],
)

def test_compatible_core_versions_snapshot_qualifier(self) -> None:
def test_compatible_min_versions_snapshot_qualifier(self) -> None:
self.assertEqual(
BuildTarget(version="1.1.2", architecture="x86", patches=["1.1.0", "1.1.1"], snapshot=True, qualifier="alpha1").compatible_core_versions,
BuildTarget(version="1.1.2", architecture="x86", patches=["1.1.0", "1.1.1"], snapshot=True, qualifier="alpha1").compatible_min_versions,
['1.1.2-alpha1-SNAPSHOT', '1.1.0', '1.1.1', '1.1.0-alpha1-SNAPSHOT', '1.1.1-alpha1-SNAPSHOT'],
)

Expand Down

0 comments on commit 98a1e87

Please sign in to comment.