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

connectivity: display reason for skipping Tests and Scenarios #1933

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

ti-mo
Copy link
Contributor

@ti-mo ti-mo commented Aug 24, 2023

I wanted to re-run a specific Test for reproducing a CI failure, but was surprised to see the test wouldn't run despite targeting it explicitly with --test. The test in question being north-south-loadbalancing, has a feature constraint that was not met in my environment. Thus began the printf rabbit hole.

This patch introduces skip reasons included in brackets after each skipped Test or Scenario. Currently, only one reason is shown, but care was taken to pick the most surprising reason for a skip. For example, excluding all tests by means of --test "!.*" would still display feature or version constraints despite the obvious test exclusion.

Some example output (using '--test no-policies/pod-to-world'):

[=] Test [no-policies]
  [-] Skipping Scenario [no-policies/pod-to-cidr] (skipped by user)
...
  [-] Scenario [no-policies/pod-to-world]
  [.] Action [no-policies/pod-to-world/http-to-one.one.one.one-0: ... (10.244.1.89) -> ... (one.one.one.one:80)]
...
  [-] Skipping Scenario [no-policies/pod-to-host] (skipped by user)
  [-] Skipping Scenario [no-policies/pod-to-external-workload] (skipped by user)
[=] Skipping Test [no-policies-from-outside] (feature node-without-cilium is disabled)
[=] Skipping Test [no-policies-extra] (skipped by user)

Since the amount of output generated by the connectivity tests has grown quite a bit since I last worked on it, I removed the first ct.Log() in ConnectivityTest.Skip() to make the output a little more compact.

RequiredCiliumVSN was renamed and changed to a string since storing the semver.Range does not allow communicating the original version constraint to the user.

A few internal methods on Test were shuffled around to keep concerns separated.

I wanted to re-run a specific Test for reproducing a CI failure, but was
surprised to see the test wouldn't run despite targeting it explicitly
with --test. The test in question being north-south-loadbalancing, has a
feature constraint that was not met in my environment. Thus began the
printf rabbit hole.

This patch introduces skip reasons included in brackets after each skipped
Test or Scenario. Currently, only one reason is shown, but care was taken
to pick the most surprising reason for a skip. For example, excluding all
tests by means of `--test "!.*"` would still display feature or version
constraints despite the obvious test exclusion.

Some example output (using '--test no-policies/pod-to-world'):

```
[=] Test [no-policies]
  [-] Skipping Scenario [no-policies/pod-to-cidr] (skipped by user)
...
  [-] Scenario [no-policies/pod-to-world]
  [.] Action [no-policies/pod-to-world/http-to-one.one.one.one-0: ... (10.244.1.89) -> ... (one.one.one.one:80)]
...
  [-] Skipping Scenario [no-policies/pod-to-host] (skipped by user)
  [-] Skipping Scenario [no-policies/pod-to-external-workload] (skipped by user)
[=] Skipping Test [no-policies-from-outside] (feature node-without-cilium is disabled)
[=] Skipping Test [no-policies-extra] (skipped by user)
```

Since the amount of output generated by the connectivity tests has grown quite
a bit since I last worked on it, I removed the first ct.Log() in
ConnectivityTest.Skip() to make the output a little more compact.

RequiredCiliumVSN was renamed and changed to a string since storing the
semver.Range does not allow communicating the original version constraint to the user.

A few internal methods on Test were shuffled around to keep concerns separated.

Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
@ti-mo ti-mo requested a review from a team as a code owner August 24, 2023 11:20
@ti-mo ti-mo requested a review from christarazi August 24, 2023 11:20
@ti-mo ti-mo temporarily deployed to ci August 24, 2023 11:20 — with GitHub Actions Inactive
@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Aug 24, 2023
@christarazi christarazi merged commit b01d711 into main Aug 24, 2023
19 checks passed
@christarazi christarazi deleted the tb/skip-reasons branch August 24, 2023 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has passed all tests and received consensus from code owners to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants