Skip to content
Closed
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ Tests/kaas/kaas-sonobuoy-tests/results/
*.tar.gz
.direnv
.vscode
Tests/sono-*
report.yaml
13 changes: 10 additions & 3 deletions Tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ Install KaaS-specific requirements:
pip install -r kaas/requirements.txt
```

Given a kubeconfig file `path/to/kubeconfig.yaml`, run
Given a kubeconfig file `path/to/kubeconfig.yaml`, run all tests (in parallel) with:

```shell
./scs-compliance-check.py -v -a kubeconfig=path/to/kubeconfig.yaml -a subject_root=. -s SUBJECT -o report.yaml scs-compatible-kaas.yaml
./scs-compliance-check.py -v -a kubeconfig=path/to/kubeconfig.yaml \
-a subject_root=. \
-s SUBJECT \
-o report.yaml \
scs-compatible-kaas.yaml
```

Replace `SUBJECT` with an arbitrary, but meaningful subject name. Also, please note that the check
Expand All @@ -64,6 +68,9 @@ Additionally, the directory `sono-results` will be generated. It contains a JUni
`plugins/e2e/results/global/junit_01.xml`. You can render it to HTML with a tool like junit2html.
This might give you hints as to why a test failed.

If you need to run tests without parallelization simply add `-a e2e-parallel="--e2e-parallel=false"`.
Some additional information can be found [here](https://github.com/vmware-tanzu/sonobuoy/issues/1435).

## Usage information (help output)

```text
Expand Down Expand Up @@ -183,7 +190,7 @@ We use a **layered approach** to allow for selective installation:
- at the very top we have `test-requirements.in`.

Whenever you change or recompile one of these layers,
*all layers above that layer have to be recompiled as well*.
_all layers above that layer have to be recompiled as well_.

Note: The Python version used for running `pip-compile` should be consistent. The currently
used version is documented in the header of the `requirements.txt`. It should match the
Expand Down
4 changes: 2 additions & 2 deletions Tests/scs-compatible-kaas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ variables:
- kubeconfig
scripts:
- executable: ./kaas/sonobuoy_handler/run_sonobuoy.py
args: run -k {kubeconfig} --scs-sonobuoy-config kaas/scs-sonobuoy-config.yaml -r {subject_root}/sono-results-e2e -c 'cncf-k8s-conformance' -a '--mode=certified-conformance'
args: run -k {kubeconfig} --scs-sonobuoy-config kaas/scs-sonobuoy-config.yaml -r {subject_root}/sono-results-e2e -c 'cncf-k8s-conformance' -a '--mode=certified-conformance {e2e-parallel}'
#~ args: -k {kubeconfig} -r {subject_root}/sono-results -c 'cncf-k8s-conformance' -a '--plugin-env e2e.E2E_DRYRUN=true'
testcases:
- id: cncf-k8s-conformance
Expand All @@ -31,7 +31,7 @@ scripts:
description: Must fulfill all requirements of scs-0214-v2.
url: https://docs.scs.community/standards/scs-0214-v2-k8s-node-distribution#decision
- executable: ./kaas/sonobuoy_handler/run_sonobuoy.py
args: run -k {kubeconfig} --scs-sonobuoy-config kaas/scs-sonobuoy-config.yaml -r {subject_root}/sono-results-0219 -c 'kaas-networking-check' -a '--e2e-focus "NetworkPolicy"'
args: run -k {kubeconfig} --scs-sonobuoy-config kaas/scs-sonobuoy-config.yaml -r {subject_root}/sono-results-0219 -c 'kaas-networking-check' -a '--e2e-focus "NetworkPolicy" {e2e-parallel}'
testcases:
- id: kaas-networking-check
description: Must fulfill all requirements of scs-0219-v1.
Expand Down
4 changes: 2 additions & 2 deletions Tests/scs-compliance-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self):
self.verbose = False
self.quiet = False
self.subject = ""
self.assignment = {}
self.assignment = { "e2e-parallel" : "--e2e-parallel=true" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the place for defaults, because this script is agnostic of the actual tests (it works the same for iaas and kaas). If we want defaults, we have to place them in the respective yaml file, and that means we have to add this feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah interesting! Haven't really noticed this, but now that you mention it: what was the rational to test k8s and openstack with one script? Imho this adds an unnecessary level of complexity here (which made it quite hard for me to add this simple param). If I think about the discussion for #1100, adding one binary was considered too much there.

Also, why is this not a place for defaults? I saw things like self.quiet = False or self.critical_only = False which looked like reasonable defaults to me. Parallel execution could/should be done in k8s and in OS envs, right?

I don't really see the way forward now, to make this happen by default and be configurable. Could you point me to something acceptable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's like saying "why are we listing two directories with the same command ls"?
This script can run any test suite, and the test suite must be given via a yaml file.

self.checkdate = datetime.date.today()
self.version = None
self.output = None
Expand Down Expand Up @@ -135,7 +135,7 @@ def apply_argv(self, argv):
self.critical_only = True
elif opt[0] == "-a" or opt[0] == "--assign":
key, value = opt[1].split("=", 1)
if key in self.assignment:
if key in self.assignment and key != "e2e-parallel":
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand why this check needs to be done. In which cases would:

  1. a "double" (not duplicate?) assignment be made?
  2. be a problem? can't we not only propagate one value to the sonobuoy script?

raise ValueError(f"Double assignment for {key!r}")
self.assignment[key] = value
elif opt[0] == "-t" or opt[0] == "--tests":
Expand Down
Loading