Skip to content

Commit

Permalink
chore: s3 cleanup (#2632)
Browse files Browse the repository at this point in the history
## Description
removes one dependency on s3 and cleanups up an example

## Checklist before merging

- [ ] Test, docs, adr added or updated as needed
- [ ] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
  • Loading branch information
AustinAbro321 committed Jun 21, 2024
1 parent abd4855 commit 9f4fa9c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
28 changes: 20 additions & 8 deletions src/pkg/packager/sources/new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,26 @@ func TestPackageSource(t *testing.T) {
t.Cleanup(func() { ts.Close() })

tests := []struct {
name string
src string
shasum string
name string
src string
shasum string
expectedErr string
}{
{
name: "local",
src: tarPath,
name: "local",
src: tarPath,
expectedErr: "",
},
{
name: "http",
src: fmt.Sprintf("%s/zarf-package-wordpress-amd64-16.0.4.tar.zst", ts.URL),
shasum: "835b06fc509e639497fb45f45d432e5c4cbd5d84212db5357b16bc69724b0e26",
name: "http",
src: fmt.Sprintf("%s/zarf-package-wordpress-amd64-16.0.4.tar.zst", ts.URL),
shasum: "835b06fc509e639497fb45f45d432e5c4cbd5d84212db5357b16bc69724b0e26",
expectedErr: "",
},
{
name: "http-insecure",
src: fmt.Sprintf("%s/zarf-package-wordpress-amd64-16.0.4.tar.zst", ts.URL),
expectedErr: "remote package provided without a shasum, use --insecure to ignore, or provide one w/ --shasum",
},
}
for _, tt := range tests {
Expand All @@ -163,6 +171,10 @@ func TestPackageSource(t *testing.T) {
packageDir := t.TempDir()
pkgLayout := layout.New(packageDir)
pkg, warnings, err := ps.LoadPackage(context.Background(), pkgLayout, filters.Empty(), false)
if tt.expectedErr != "" {
require.EqualError(t, err, tt.expectedErr)
return
}
require.NoError(t, err)
require.Empty(t, warnings)
require.Equal(t, expectedPkg, pkg)
Expand Down
7 changes: 0 additions & 7 deletions src/test/e2e/00_use_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@ func TestUseCLI(t *testing.T) {
require.Contains(t, stdErr, expectedOutString, "The log level should be changed to 'debug'")
})

t.Run("bad zarf package deploy w/o --insecure or --shasum", func(t *testing.T) {
t.Parallel()
// Test that `zarf package deploy` gives an error if deploying a remote package without the --insecure or --shasum flags
stdOut, stdErr, err := e2e.Zarf("package", "deploy", "https://zarf-examples.s3.amazonaws.com/zarf-package-appliance-demo-doom-20210125.tar.zst", "--confirm")
require.Error(t, err, stdOut, stdErr)
})

t.Run("zarf package to test bad remote images", func(t *testing.T) {
_, stdErr, err := e2e.Zarf("package", "create", "src/test/packages/00-remote-pull-fail", "--confirm")
// expecting zarf to have an error and output to stderr
Expand Down

0 comments on commit 9f4fa9c

Please sign in to comment.