Skip to content

Commit

Permalink
shorten test to focus on what we're testing
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Abro <[email protected]>
  • Loading branch information
AustinAbro321 committed Dec 16, 2024
1 parent f505433 commit bac67fa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 63 deletions.
57 changes: 9 additions & 48 deletions src/pkg/lint/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func TestLintPackageWithImports(t *testing.T) {
}
ctx := context.Background()
findings := []PackageFinding{
// unset exists in both the root and imported package
{
YqPath: "",
Description: "package template UNSET is not set and won't be evaluated during lint",
Expand All @@ -111,68 +112,28 @@ func TestLintPackageWithImports(t *testing.T) {
PackagePathOverride: "linted-import",
Severity: SevWarn,
},
{
YqPath: ".components.[0].images.[0]",
Description: "Image not pinned with digest",
Item: "ghcr.io/zarf-dev/doom-game:0.0.1",
PackageNameOverride: "dos-games",
PackagePathOverride: "oci://ghcr.io/zarf-dev/packages/dos-games:1.1.0",
Severity: SevWarn,
},
{
YqPath: ".components.[1].images.[0]",
Description: "Image not pinned with digest",
Item: "registry.com:9001/whatever/image:latest",
PackageNameOverride: "linted-import",
PackagePathOverride: "linted-import",
Severity: SevWarn,
},
{
YqPath: ".components.[1].images.[2]",
Description: "Image not pinned with digest",
Item: "busybox:latest",
PackageNameOverride: "linted-import",
PackagePathOverride: "linted-import",
Severity: SevWarn,
},
{
YqPath: "",
Description: "package template UBUNTU_IMAGE is not set and won't be evaluated during lint",
Description: "package template UNSET is not set and won't be evaluated during lint",
Item: "",
PackageNameOverride: "lint",
PackagePathOverride: ".",
Severity: SevWarn,
},
{
YqPath: ".components.[1].repos.[0]",
Description: "Unpinned repository",
Item: "https://github.com/zarf-dev/zarf-public-test.git",
PackageNameOverride: "lint",
PackagePathOverride: ".",
Severity: SevWarn,
},
{
YqPath: ".components.[1].repos.[2]",
Description: "Unpinned repository",
Item: "https://gitlab.com/gitlab-org/build/omnibus-mirror/pcre2/-/tree/vreverse?ref_type=heads",
PackageNameOverride: "lint",
PackagePathOverride: ".",
Severity: SevWarn,
},
{
YqPath: ".components.[1].images.[0]",
YqPath: ".components.[0].images.[0]",
Description: "Image not pinned with digest",
Item: "registry.com:9001/whatever/image:1.0.0",
PackageNameOverride: "lint",
PackagePathOverride: ".",
Item: "ghcr.io/zarf-dev/doom-game:0.0.1",
PackageNameOverride: "dos-games",
PackagePathOverride: "oci://ghcr.io/zarf-dev/packages/dos-games:1.1.0",
Severity: SevWarn,
},
{
YqPath: ".components.[1].images.[2]",
YqPath: ".components.[1].images.[0]",
Description: "Image not pinned with digest",
Item: "busybox:latest",
PackageNameOverride: "lint",
PackagePathOverride: ".",
PackageNameOverride: "linted-import",
PackagePathOverride: "linted-import",
Severity: SevWarn,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ variables:

components:
- name: dont-care
images:
- image-that-should-not-show-up-in-lint:unpinned

- name: import-test
images:
- registry.com:9001/whatever/image:latest
- busybox@sha256:3fbc632167424a6d997e74f52b878d7cc478225cffac6bc977eedfe51c7f4e79
- busybox:###ZARF_PKG_TMPL_BUSYBOX_IMAGE###
- busybox@sha256:3fbc632167424a6d997e74f52b878d7cc478225cffac6bc977eedfe51c7f4e79
- busybox:###ZARF_PKG_TMPL_UNSET###

- name: oci-games-url
Expand Down
14 changes: 1 addition & 13 deletions src/pkg/lint/testdata/lint-with-imports/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,9 @@ components:
path: linted-import

- name: full-repo
repos:
- https://github.com/zarf-dev/zarf-public-test.git
- https://dev.azure.com/defenseunicorns/zarf-public-test/_git/[email protected]
- https://gitlab.com/gitlab-org/build/omnibus-mirror/pcre2/-/tree/vreverse?ref_type=heads
images:
- registry.com:9001/whatever/image:1.0.0
- busybox@sha256:3fbc632167424a6d997e74f52b878d7cc478225cffac6bc977eedfe51c7f4e79
- busybox:###ZARF_PKG_TMPL_BUSYBOX_IMAGE###
- ubuntu:###ZARF_PKG_TMPL_UBUNTU_IMAGE###
files:
- source: https://github.com/k3s-io/k3s/releases/download/v1.28.2+k3s1/k3s
shasum: 2f041d37a2c6d54d53e106e1c7713bc48f806f3919b0d9e092f5fcbdc55b41cf
target: src/
- source: file-without-shasum.txt
target: src/
- busybox:###ZARF_PKG_TMPL_UNSET###

- name: oci-games-url
import:
Expand Down

0 comments on commit bac67fa

Please sign in to comment.