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 7d21204 commit f505433
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 33 deletions.
3 changes: 0 additions & 3 deletions src/pkg/lint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ func templateZarfObj(zarfObj any, setVariables map[string]string) ([]PackageFind
})
}
}
// if unSetTemplates {

// }
for key, value := range setVariables {
templateMap[fmt.Sprintf("%s%s###", templatePrefix, key)] = value
}
Expand Down
26 changes: 5 additions & 21 deletions src/pkg/lint/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,61 +144,45 @@ func TestLintPackageWithImports(t *testing.T) {
Severity: SevWarn,
},
{
YqPath: ".components.[2].repos.[0]",
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.[2].repos.[2]",
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.[2].images.[0]",
YqPath: ".components.[1].images.[0]",
Description: "Image not pinned with digest",
Item: "registry.com:9001/whatever/image:1.0.0",
PackageNameOverride: "lint",
PackagePathOverride: ".",
Severity: SevWarn,
},
{
YqPath: ".components.[2].images.[2]",
YqPath: ".components.[1].images.[2]",
Description: "Image not pinned with digest",
Item: "busybox:latest",
PackageNameOverride: "lint",
PackagePathOverride: ".",
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.[6].images.[0]",
YqPath: ".components.[4].images.[0]",
Description: "Image not pinned with digest",
Item: "image-in-good-flavor-component:unpinned",
PackageNameOverride: "lint",
PackagePathOverride: ".",
Severity: SevWarn,
},
{
YqPath: ".components.[0].import",
Description: "Additional property not-path is not allowed",
Item: "",
PackageNameOverride: "",
PackagePathOverride: "",
Severity: SevErr,
},
}
cwd, err := os.Getwd()
require.NoError(t, err)
Expand Down
9 changes: 0 additions & 9 deletions src/pkg/lint/testdata/lint-with-imports/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ metadata:
name: lint

components:
- name: first-test-component
import:
not-path: packages/distros/k3s

- name: import-test
import:
path: linted-import
Expand All @@ -28,11 +24,6 @@ components:
- source: file-without-shasum.txt
target: src/

- name: oci-games-url
import:
url: oci://ghcr.io/zarf-dev/packages/dos-games:1.1.0
name: baseline

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

0 comments on commit f505433

Please sign in to comment.