Skip to content

Commit

Permalink
Merge pull request #544 from vshn/golden-tests
Browse files Browse the repository at this point in the history
Consolidate golden tests
  • Loading branch information
zugao authored Nov 20, 2024
2 parents a805933 + 3cb9c14 commit 427cc85
Show file tree
Hide file tree
Showing 927 changed files with 75,751 additions and 20,030 deletions.
15 changes: 12 additions & 3 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def yaml_path_recursion(yaml_dict, path):
return yaml_path_recursion(yaml_dict.get(path[0], {}), path[1:])

current_dir = os.path.dirname(os.path.realpath(__file__))
tests_vshn_file = os.path.join(current_dir, '../../tests/vshn.yml')
tests_vshn_cloud_file = os.path.join(current_dir, '../../tests/vshn-cloud.yml')
tests_vshn_managed_file = os.path.join(current_dir, '../../tests/vshn-managed.yml')
defaults_file = os.path.join(current_dir, '../../class/defaults.yml')


Expand All @@ -25,12 +26,20 @@ keys_to_check_yaml = [
'parameters.appcat.services.emailAlerting.smtpPassword',
]

with open(tests_vshn_file, 'r') as f:
with open(tests_vshn_cloud_file, 'r') as f:
defaults = yaml.safe_load(f)
for key in keys_to_check_yaml:
splitted = key.split(".")
if yaml_path_recursion(defaults, splitted):
print(f'password is not empty in or broken vault declaration in {tests_vshn_file} for key {key}')
print(f'password is not empty in or broken vault declaration in {tests_vshn_cloud_file} for key {key}')
sys.exit(1)

with open(tests_vshn_managed_file, 'r') as f:
defaults = yaml.safe_load(f)
for key in keys_to_check_yaml:
splitted = key.split(".")
if yaml_path_recursion(defaults, splitted):
print(f'password is not empty in or broken vault declaration in {tests_vshn_managed_file} for key {key}')
sys.exit(1)

with open(defaults_file, 'r') as f:
Expand Down
46 changes: 5 additions & 41 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,17 @@ jobs:
- name: Run ${{ matrix.command }}
run: make ${{ matrix.command }}

test:
runs-on: ubuntu-latest
strategy:
matrix:
instance:
- defaults
- exoscale
- cloudscale
- openshift
- vshn
- apiserver
- controllers
- minio
- cloudscale-metrics-collector-cloud
- cloudscale-metrics-collector-managed
- exoscale-metrics-collector-cloud
- exoscale-metrics-collector-managed
- control-plane
- service-cluster
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
steps:
- uses: actions/checkout@v4
with:
path: ${{ env.COMPONENT_NAME }}
- name: Compile component
run: make test -e instance=${{ matrix.instance }}
golden:
runs-on: ubuntu-latest
strategy:
matrix:
instance:
- defaults
- exoscale
- cloudscale
- openshift
- vshn
- apiserver
- controllers
- minio
- cloudscale-metrics-collector-cloud
- cloudscale-metrics-collector-managed
- exoscale-metrics-collector-cloud
- exoscale-metrics-collector-managed
- control-plane
- vshn-cloud
- vshn-managed
- service-cluster
- control-plane
- defaults
- dev
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)

instance ?= defaults
test_instances = tests/defaults.yml tests/billing.yaml tests/exoscale.yml tests/cloudscale.yml tests/openshift.yml tests/vshn.yml tests/apiserver.yml tests/controllers.yml tests/minio.yml tests/cloudscale-metrics-collector-cloud.yml tests/cloudscale-metrics-collector-managed.yml tests/exoscale-metrics-collector-cloud.yml tests/exoscale-metrics-collector-managed.yml tests/control-plane.yml tests/service-cluster.yml
test_instances = tests/defaults.yml tests/vshn-cloud.yml tests/vshn-managed.yml tests/control-plane.yml tests/service-cluster.yml tests/dev.yml

YAMLLINT_ARGS ?= --no-warnings
YAMLLINT_CONFIG ?= .yamllint.yml
Expand Down
41 changes: 0 additions & 41 deletions tests/billing.yml

This file was deleted.

26 changes: 0 additions & 26 deletions tests/cloudscale-metrics-collector-cloud.yml

This file was deleted.

25 changes: 0 additions & 25 deletions tests/cloudscale-metrics-collector-managed.yml

This file was deleted.

41 changes: 0 additions & 41 deletions tests/cloudscale.yml

This file was deleted.

28 changes: 0 additions & 28 deletions tests/controllers.yml

This file was deleted.

File renamed without changes.
30 changes: 0 additions & 30 deletions tests/exoscale-metrics-collector-cloud.yml

This file was deleted.

30 changes: 0 additions & 30 deletions tests/exoscale-metrics-collector-managed.yml

This file was deleted.

40 changes: 0 additions & 40 deletions tests/exoscale.yml

This file was deleted.

Empty file.
Loading

0 comments on commit 427cc85

Please sign in to comment.