From 80e48fabf504fe272902409c7e9495f29f8e87e8 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Wed, 7 Dec 2022 18:02:53 +0000 Subject: [PATCH 1/4] Bumping version from 0.1.60 to 0.1.61 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6bc07245..65105e87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "redis-benchmarks-specification" -version = "0.1.60" +version = "0.1.61" description = "The Redis benchmarks specification describes the cross-language/tools requirements and expectations to foster performance and observability standards around redis related technologies. Members from both industry and academia, including organizations and individuals are encouraged to contribute." authors = ["filipecosta90 ","Redis Performance Group "] readme = "Readme.md" From 1475c2b2b78feaf11a2f453ae694cb04e8760f36 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Thu, 8 Dec 2022 10:26:51 +0000 Subject: [PATCH 2/4] Validated SPEC fields uppon PR and commit --- .github/workflows/validate-spec-fields.yml | 40 +++++++++++++++++++ .../__cli__/args.py | 6 +++ .../__cli__/stats.py | 17 +++++++- 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/validate-spec-fields.yml diff --git a/.github/workflows/validate-spec-fields.yml b/.github/workflows/validate-spec-fields.yml new file mode 100644 index 00000000..4772c8a3 --- /dev/null +++ b/.github/workflows/validate-spec-fields.yml @@ -0,0 +1,40 @@ +name: Validate SPEC fields +on: + pull_request: + push: + branches: + - main + +jobs: + pytest: + name: Publish to PyPi + runs-on: ubuntu-latest + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + steps: + - uses: actions/checkout@master + + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.10' + + - uses: docker-practice/actions-setup-docker@master + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + + - name: Install Dev requirements + run: | + pip install -U setuptools wheel + pip install -r dev_requirements.txt + + - name: Install Dependencies + run: | + poetry install + + - name: Validate SPEC fields + if: github.event_name == 'release' + run: | + poetry run redis-benchmarks-spec-cli --tool stats --fail-on-required-diff diff --git a/redis_benchmarks_specification/__cli__/args.py b/redis_benchmarks_specification/__cli__/args.py index 6dc962d4..5bbcbd87 100644 --- a/redis_benchmarks_specification/__cli__/args.py +++ b/redis_benchmarks_specification/__cli__/args.py @@ -40,6 +40,12 @@ def spec_cli_args(parser): action="store_true", help="Override test specs.", ) + parser.add_argument( + "--fail-on-required-diff", + default=False, + action="store_true", + help="Fail tool when there is difference between required parameters.", + ) parser.add_argument( "--push-stats-redis", default=False, diff --git a/redis_benchmarks_specification/__cli__/stats.py b/redis_benchmarks_specification/__cli__/stats.py index c6062992..7e9555c7 100644 --- a/redis_benchmarks_specification/__cli__/stats.py +++ b/redis_benchmarks_specification/__cli__/stats.py @@ -44,11 +44,15 @@ def generate_stats_cli_command_logic(args, project_name, project_version): ) ) tracked_groups = [] + override_enabled = args.override_tests + fail_on_required_diff = args.fail_on_required_diff + overall_result = True for test_file in testsuite_spec_files: benchmark_config = {} requires_override = False - override_enabled = args.override_tests + test_result = True with open(test_file, "r") as stream: + try: benchmark_config = yaml.safe_load(stream) test_name = benchmark_config["name"] @@ -126,8 +130,13 @@ def generate_stats_cli_command_logic(args, project_name, project_version): test_file, e.__str__() ) ) + test_result = False pass + if requires_override: + test_result = False + overall_result &= test_result + if requires_override and override_enabled: logging.info( "Saving a new version of the file {} with the overrided data".format( @@ -146,6 +155,12 @@ def generate_stats_cli_command_logic(args, project_name, project_version): total_tracked_groups = len(tracked_groups) logging.info("Total tracked groups: {}".format(total_tracked_groups)) + if overall_result is False and fail_on_required_diff: + logging.error( + "Failing given there were changes required to be made and --fail-on-required-diff was enabled" + ) + exit(1) + if args.commandstats_csv != "": logging.info( "Reading commandstats csv {} to determine commands/test coverage".format( From 9d7ea8051c1e6655acf3cdaaacf39773a7065e63 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Thu, 8 Dec 2022 10:29:33 +0000 Subject: [PATCH 3/4] Removed validate spec condition --- .github/workflows/validate-spec-fields.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/validate-spec-fields.yml b/.github/workflows/validate-spec-fields.yml index 4772c8a3..8b2ecd69 100644 --- a/.github/workflows/validate-spec-fields.yml +++ b/.github/workflows/validate-spec-fields.yml @@ -35,6 +35,5 @@ jobs: poetry install - name: Validate SPEC fields - if: github.event_name == 'release' run: | poetry run redis-benchmarks-spec-cli --tool stats --fail-on-required-diff From 3604079c07ece15be961121477c3a11c9553d840 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Thu, 8 Dec 2022 10:30:13 +0000 Subject: [PATCH 4/4] Removed validate spec condition --- .github/workflows/validate-spec-fields.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-spec-fields.yml b/.github/workflows/validate-spec-fields.yml index 8b2ecd69..b8b1ea99 100644 --- a/.github/workflows/validate-spec-fields.yml +++ b/.github/workflows/validate-spec-fields.yml @@ -7,7 +7,7 @@ on: jobs: pytest: - name: Publish to PyPi + name: Validate SPEC fields runs-on: ubuntu-latest env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true