diff --git a/scripts/compare_releases.py b/scripts/compare_releases.py index 1cfbba3..1342dcf 100644 --- a/scripts/compare_releases.py +++ b/scripts/compare_releases.py @@ -10,10 +10,12 @@ def min_version(v1, v2): return v2 if version_to_number(v1) > version_to_number(v2) else v1 -def version_between(v, v_min, v_max): - ge_min = v_min is None or version_to_number(v) >= version_to_number(v_min) - le_max = v_max is None or version_to_number(v) <= version_to_number(v_max) - return ge_min and le_max +def release_between(release, min_version, max_version): + max_ver = 999999999 if max_version is None else version_to_number(max_version) + min_ver = 0 if min_version is None else version_to_number(min_version) + rel = version_to_number(release) + + return min_ver <= rel <= max_ver def version_to_number(version): diff --git a/scripts/report.py b/scripts/report.py index e66017b..c984537 100644 --- a/scripts/report.py +++ b/scripts/report.py @@ -1,4 +1,4 @@ -from scripts.compare_releases import max_version, min_version +from compare_releases import max_version, min_version class Report: diff --git a/scripts/validate_ol_events.py b/scripts/validate_ol_events.py index 1d4cec8..7846e79 100644 --- a/scripts/validate_ol_events.py +++ b/scripts/validate_ol_events.py @@ -7,6 +7,7 @@ from os.path import isfile, join, isdir from jsonschema import Draft202012Validator from report import Test, Scenario, Component, Report +from compare_releases import release_between from compare_events import match @@ -119,22 +120,6 @@ def all_tests_succeeded(syntax_tests): return not any(t.status == "FAILURE" for t in syntax_tests.values()) -def version_to_number(version): - split = version.split('.') - major = int(split[0]) - minor = int(split[0]) - patch = int(split[0]) - return major * 1000000 + minor * 1000 + patch - - -def release_between(release, min_version, max_version): - max_ver = 999999999 if max_version is None else version_to_number(max_version) - min_ver = 0 if min_version is None else version_to_number(min_version) - rel = version_to_number(release) - - return min_ver <= rel <= max_ver - - def get_expected_events(producer_dir, component, scenario_name, config, release): if component == 'scenarios': return None