Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update integration test dependencies #447

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ updates:
applies-to: "version-updates"
patterns:
- "*"
- package-ecosystem: pip
groups:
testing:
applies-to: "version-updates"
patterns:
- "*"
directory: "/scripts"
schedule:
interval: "monthly"
8 changes: 3 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,15 @@ jobs:
fi

- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: '3.9'
uses: ./.github/actions/setup-python

- name: Set up Python scripts on PR branch
working-directory: ./chart-verifier
run: |
# set up python requirements and scripts on PR branch
python3 -m venv ve1
cd scripts && ../ve1/bin/pip3 install -r requirements.txt && cd ..
cd scripts && ../ve1/bin/python3 setup.py install && cd ..
cd scripts && ../ve1/bin/pip3 install . && cd ..

- name: Check if only release file in PR
working-directory: ./chart-verifier
Expand Down Expand Up @@ -154,7 +152,7 @@ jobs:
echo $(pwd)
python3 -m venv ve1
cd scripts && ../ve1/bin/pip3 install -r requirements.txt && cd ..
cd scripts && ../ve1/bin/python3 setup.py install && cd ..
cd scripts && ../ve1/bin/pip3 install . && cd ..

- name: Check for restricted files and user permissiom
id: check_authorization
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/dev_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ jobs:
go-version-file: go.mod

- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: '3.9'
uses: ./.github/actions/setup-python

- name: Set up Python scripts
run: |
# set up python requirements and scripts on PR branch
python3 -m venv ve1
cd scripts && ../ve1/bin/pip3 install -r requirements.txt && cd ..
cd scripts && ../ve1/bin/python3 setup.py install && cd ..
cd scripts && ../ve1/bin/pip3 install . install && cd ..

- name: Build Binary
id: build-binary
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/python-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
# Only trigger on changes to Python source.
- 'scripts/**.py'
- 'tests/**.py'
- 'scripts/requirements.txt'
- 'scripts/pyproject.toml'
- 'scripts/setup.py'
- 'scripts/setup.cfg'

jobs:
enforce:
Expand All @@ -14,18 +18,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.x Part 1
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Set up Python
uses: ./.github/actions/setup-python

- name: Install style tooling
run: make venv.codestyle

- name: Run formatter
run: make py.ci.format

# Temporarily auto-pass linting until we are able to manually review and
# address.
- name: Run linter
run: make py.lint
run: make py.lint
6 changes: 2 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,14 @@ jobs:
fi

- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: '3.9'
uses: ./.github/actions/setup-python

- name: Set up Python scripts
run: |
# set up python requirements and scripts on PR branch
python3 -m venv ve1
cd scripts && ../ve1/bin/pip3 install -r requirements.txt && cd ..
cd scripts && ../ve1/bin/python3 setup.py install && cd ..
cd scripts && ../ve1/bin/pip3 install . && cd ..

- name: Generate release body
id: release_body
Expand Down
36 changes: 35 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,38 @@ report-info.*

# ignore python venvs
ve1/
venv.*/
venv.*/

*.egg-info
sanity-check.py
.cr-release-packages/*.tgz
oc

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST


# For Pyenv users
.python-version
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ venv.tools:
.PHONY: venv.tools.always-reinstall
venv.tools.always-reinstall:
$(PY_BIN) -m venv $(VENV_TOOLS)
./$(VENV_TOOLS_BIN)/pip install -r requirements.txt
./$(VENV_TOOLS_BIN)/python setup.py install
./$(VENV_TOOLS_BIN)/pip install -r ./scripts/requirements.txt
./$(VENV_TOOLS_BIN)/pip install ./scripts
cd ..


### Developer Tooling Installation
Expand Down
4 changes: 2 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ignore = [
lint.ignore = [
"E203" # https://github.com/PyCQA/pycodestyle/issues/373
]
]
3 changes: 3 additions & 0 deletions scripts/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
50 changes: 25 additions & 25 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
attrs==21.2.0
certifi==2020.12.5
chardet==4.0.0
deepdiff==5.6.0
gitdb==4.0.7
GitPython==3.1.18
attrs==23.2.0
certifi==2024.6.2
chardet==5.2.0
deepdiff==7.0.1
gitdb==4.0.11
GitPython==3.1.43
glob2==0.7
idna==2.10
iniconfig==1.1.1
mako==1.2.3
MarkupSafe==2.0.1
packaging==21.0
parse==1.19.0
parse-type==0.5.2
pluggy==0.13.1
py==1.10.0
PyGithub==1.55
pyparsing==2.4.7
pytest==6.2.4
pytest-bdd==4.1.0
PyYAML==5.4.1
requests==2.25.1
retrying==1.3.3
semver==2.13.0
idna==3.7
iniconfig==2.0.0
mako==1.3.5
MarkupSafe==2.1.5
packaging==24.0
parse==1.20.1
parse-type==0.6.2
pluggy==1.5.0
py==1.11.0
PyGithub==2.3.0
pyparsing==3.1.2
pytest==8.2.2
pytest-bdd==7.2.0
PyYAML==6.0.1
requests==2.32.3
retrying==1.3.4
semver==3.0.2
six==1.16.0
smmap==4.0.0
smmap==5.0.1
toml==0.10.2
urllib3==1.26.5
urllib3==2.2.1
six==1.16.0
retry==0.9.2
4 changes: 0 additions & 4 deletions scripts/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[metadata]
name = rh-chart-verifier
version = 0.1.0
Expand Down
15 changes: 7 additions & 8 deletions tests/tests/functional/chart_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
deploy the charts on.
"""


from pytest_bdd import scenario, given, when, then, parsers
import os
import subprocess
Expand Down Expand Up @@ -47,23 +46,23 @@ def test_chart_signed():


@given(
parsers.parse("I would like to use the <type> profile"),
parsers.parse("I would like to use the {category} profile"),
target_fixture="profile_type",
)
def profile_type(type):
return type
def profile_type(category):
return category


@given(
parsers.parse("I will provide a <location> of a <helm_chart>"),
parsers.parse("I will provide a {location} of a {helm_chart}"),
target_fixture="chart_location",
)
def chart_location(location, helm_chart):
return os.path.join(location, helm_chart)


@given(
parsers.parse("I will provide a <location> of an expected <report_info>"),
parsers.parse("I will provide a {location} of an expected {report_info}"),
target_fixture="report_info_location",
)
def report_info_location(location, report_info):
Expand All @@ -72,7 +71,7 @@ def report_info_location(location, report_info):

@given(
parsers.parse(
"I will provide a <location> of a <public_key> to verify the signature"
"I will provide a {location} of a {public_key} to verify the signature"
),
target_fixture="public_key_location",
)
Expand All @@ -81,7 +80,7 @@ def public_key_location(location, public_key):


@given(
parsers.parse("I will use the chart verifier <image_type> image"),
parsers.parse("I will use the chart verifier {image_type} image"),
target_fixture="image_type",
)
def image_type(image_type):
Expand Down
45 changes: 26 additions & 19 deletions tests/tests/functional/features/chart_good.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,47 @@ Feature: Chart verification
Partners or redhat or community can verify their charts by running the
chart verifier against an error free chart.

Examples:
| image_type |
| tarball |
| podman |

@source
Scenario Outline: A chart provider verifies their chart using the chart verifier
Given I would like to use the <type> profile
Given I would like to use the <category> profile
Given I will provide a <location> of a <helm_chart>
Given I will provide a <location> of an expected <report_info>
Given I will use the chart verifier <image_type> image
Given The chart verifier version value
When I run the chart-verifier verify command against the chart to generate a report
Then I should see the report-info from the generated report matching the expected report-info

Examples:
| type | location | helm_chart | report_info |
| partner | tests/charts/psql-service/0.1.8/ | src | partner-report-info.json |
| partner | tests/charts/psql-service/0.1.9/ | psql-service-0.1.9.tgz | partner-report-info.json |
| redhat | tests/charts/psql-service/0.1.8/ | src | redhat-report-info.json |
| redhat | tests/charts/psql-service/0.1.9/ | psql-service-0.1.9.tgz | redhat-report-info.json |
| community | tests/charts/psql-service/0.1.8/ | src | community-report-info.json |
| community | tests/charts/psql-service/0.1.9/ | psql-service-0.1.9.tgz | community-report-info.json |
| category | location | helm_chart | report_info | image_type |
# test with tarball
| partner | tests/charts/psql-service/0.1.8/ | src | partner-report-info.json | tarball |
| partner | tests/charts/psql-service/0.1.9/ | psql-service-0.1.9.tgz | partner-report-info.json | tarball |
| redhat | tests/charts/psql-service/0.1.8/ | src | redhat-report-info.json | tarball |
| redhat | tests/charts/psql-service/0.1.9/ | psql-service-0.1.9.tgz | redhat-report-info.json | tarball |
| community | tests/charts/psql-service/0.1.8/ | src | community-report-info.json | tarball |
| community | tests/charts/psql-service/0.1.9/ | psql-service-0.1.9.tgz | community-report-info.json | tarball |
# Testing with Podman
| partner | tests/charts/psql-service/0.1.8/ | src | partner-report-info.json | podman |
| partner | tests/charts/psql-service/0.1.9/ | psql-service-0.1.9.tgz | partner-report-info.json | podman |
| redhat | tests/charts/psql-service/0.1.8/ | src | redhat-report-info.json | podman |
| redhat | tests/charts/psql-service/0.1.9/ | psql-service-0.1.9.tgz | redhat-report-info.json | podman |
| community | tests/charts/psql-service/0.1.8/ | src | community-report-info.json | podman |
| community | tests/charts/psql-service/0.1.9/ | psql-service-0.1.9.tgz | community-report-info.json | podman |

@signed
Scenario Outline: A chart provider verifies their signed chart using the chart verifier
Given I would like to use the <type> profile
Given I would like to use the <category> profile
Given I will provide a <location> of a <helm_chart>
Given I will provide a <location> of an expected <report_info>
Given I will use the chart verifier <image_type> image
Given I will provide a <location> of a <public_key> to verify the signature
Given The chart verifier version value
When I run the chart-verifier verify command against the signed chart to generate a report
Then I should see the report-info from the report for the signed chart matching the expected report-info

Examples:
| type | location | helm_chart | report_info | public_key |
| partner | tests/charts/psql-service/0.1.11/ | psql-service-0.1.11.tgz | partner-report-info.json | psql-service-0.1.11.tgz.key |
| redhat | tests/charts/psql-service/0.1.11/ | psql-service-0.1.11.tgz | redhat-report-info.json | psql-service-0.1.11.tgz.key |
| category | location | helm_chart | report_info | public_key | image_type |
# test with tarball
| partner | tests/charts/psql-service/0.1.11/ | psql-service-0.1.11.tgz | partner-report-info.json | psql-service-0.1.11.tgz.key | tarball |
| redhat | tests/charts/psql-service/0.1.11/ | psql-service-0.1.11.tgz | redhat-report-info.json | psql-service-0.1.11.tgz.key | tarball |
# test with podman
| partner | tests/charts/psql-service/0.1.11/ | psql-service-0.1.11.tgz | partner-report-info.json | psql-service-0.1.11.tgz.key | podman |
| redhat | tests/charts/psql-service/0.1.11/ | psql-service-0.1.11.tgz | redhat-report-info.json | psql-service-0.1.11.tgz.key | podman |