Skip to content

Commit

Permalink
add tests for last fix
Browse files Browse the repository at this point in the history
Signed-off-by: ashpect <ashishndiitr@gmail.com>
  • Loading branch information
ashpect committed Aug 24, 2023
1 parent 872c669 commit 95b3e49
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/e2e/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,23 @@ func TestPullImageOfBundle(t *testing.T) {
_, err := imgpkg.RunWithOpts([]string{"pull", "--tty", "-i", randomBundle.RefDigest, "-o", pullDir}, helpers.RunOpts{
AllowError: true,
StderrWriter: out,
StdoutWriter: out,
})

require.Error(t, err)
assert.Contains(t, out.String(), "Expected bundle flag when pulling a bundle (hint: Use -b instead of -i for bundles)")
})

t.Run("when --image-is-bundle-check=false is provided while using the -b flag it fails", func(t *testing.T) {
pullDir := env.Assets.CreateTempFolder("pull-bundle-image")
out := bytes.NewBufferString("")
_, err := imgpkg.RunWithOpts([]string{"pull", "--tty", "-b", randomBundle.RefDigest, "-o", pullDir, "--image-is-bundle-check=false"}, helpers.RunOpts{
AllowError: true,
StderrWriter: out,
})
require.Error(t, err)
assert.Contains(t, out.String(), "Cannot set --image-is-bundle-check while using -b flag")
})

t.Run("when --image-is-bundle-check=false is provided downloads the OCI Image of the bundle", func(t *testing.T) {
pullDir := env.Assets.CreateTempFolder("pull-bundle-image")
imgpkg.RunWithOpts([]string{"pull", "--tty", "-i", randomBundle.RefDigest, "-o", pullDir, "--image-is-bundle-check=false"}, helpers.RunOpts{})
Expand Down

0 comments on commit 95b3e49

Please sign in to comment.