0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-01-06 22:40:28 -05:00
zot/pkg/cli
Andrei Aaron af222de108
test: refactor CVE tests in CLI package (#1170)
Changes in this commit:

A.
There were nested conveys following the pattern:
- outer convey was a positive test
- inner conveys were negative tests
The positive and negative tests did not depend on one another, but the positive test was repeated for each negative test.

So for example if there was 1 positive test and 2 negative tests what go would do is:
1. execute the outer convey with the positive test
2. execute the 1st inner convey with the 1st negative test
3. execute the outer convey with the positive test
4. execute the 2nd inner convey with the 2nd negative test

Since there were no dependencies between these tests they can be moved on the same level.

B.
The test function bringing up the controller for `TestServerCVEResponseGQL` was the same for `TestServerCVEResponse`, so I removed `TestServerCVEResponseGQL` and moved the Conveys under `TestServerCVEResponse`. This will save time on the initial TrivyDB download, since it's done only once when the controller starts.

C. The `Convey("without flags", func() {` was actually the same as the test under which it was nested: `Convey("Test CVE invalid url port", t, func() {` no code differences so I removed it.

D. Use the new test functions to start/stop and wait for the zot contoller to be reachable

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-02-06 13:16:28 -08:00
..
cli.go build(tags): remove redundant build tag ui_base (#857) 2022-10-10 15:05:55 +03:00
client.go fix: removed resty calls from sync (#1016) 2022-12-22 10:19:42 -08:00
client_elevated_test.go refactor: Cleanup/simplify testcases in /pkg/cli (#1103) 2023-01-16 21:52:50 -08:00
client_test.go test(refactor): cleanup/simplify testcases (#1124) 2023-01-20 10:01:52 -08:00
config_cmd.go chore(lint): gci to separate zot from other imports (#870) 2022-10-20 09:39:20 -07:00
config_cmd_test.go chore(lint): gci to separate zot from other imports (#870) 2022-10-20 09:39:20 -07:00
config_reloader.go chore(lint): gci to separate zot from other imports (#870) 2022-10-20 09:39:20 -07:00
config_reloader_test.go fix: removed references to old dist-spec (#1128) 2023-01-31 09:35:33 -08:00
cve_cmd.go fix(cli): do not show signatures and fix tls verification client side (#904) 2022-10-22 23:44:20 -07:00
cve_cmd_test.go test: refactor CVE tests in CLI package (#1170) 2023-02-06 13:16:28 -08:00
discover.go fix(cli): do not show signatures and fix tls verification client side (#904) 2022-10-22 23:44:20 -07:00
extensions_test.go fix(ci): do not use "ghcr.io/aquasecurity/trivy-db" for ci (#1107) 2023-01-18 14:18:03 -08:00
image_cmd.go fix(cli): do not show signatures and fix tls verification client side (#904) 2022-10-22 23:44:20 -07:00
image_cmd_test.go feat(repodb): DerivedImageList and BaseImageList make use of RepoDB (#1135) 2023-01-25 14:06:02 -08:00
minimal.go build(tags): remove redundant build tag ui_base (#857) 2022-10-10 15:05:55 +03:00
repo_cmd.go chore(lint): gci to separate zot from other imports (#870) 2022-10-20 09:39:20 -07:00
root.go fix(config): warn if cve is used with remote storage driver (#1034) 2022-11-30 09:35:06 +02:00
root_test.go chore(trivy): update trivy version and enforce OCI compliant repo names in local image storage (#1068) 2023-01-18 08:24:44 -08:00
searcher.go feat(repodb): DerivedImageList and BaseImageList make use of RepoDB (#1135) 2023-01-25 14:06:02 -08:00
service.go feat(repodb): DerivedImageList and BaseImageList make use of RepoDB (#1135) 2023-01-25 14:06:02 -08:00
stress_test.go refactor: Cleanup/simplify testcases in /pkg/cli (#1103) 2023-01-16 21:52:50 -08:00