Skip to content

Commit

Permalink
Update e2e tests for Content-Type
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Ash committed Oct 15, 2018
1 parent 050a3a8 commit d0d1ef9
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/e2e/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,49 @@ func TestPush(t *testing.T) {
}
}

func TestPushWithContentType(t *testing.T) {
t.Log("Test basic push action with Content-Type")

name := "test-push"
dir := "charts"
setupRepo(t, name, dir)
defer teardownRepo(t, name)

key := dir + "/foo-1.2.3.tgz"

// set a cleanup in beforehand
defer func() {
if err := mc.RemoveObject(name, key); err != nil {
t.Errorf("Unexpected error: %v", err)
}
}()

contentType := "application/x-gzip"
cmd, stdout, stderr := command(fmt.Sprintf("helm s3 push --content-type=%s testdata/foo-1.2.3.tgz %s", contentType, name))
if err := cmd.Run(); err != nil {
t.Errorf("Unexpected error: %v", err)
}
if stdout.String() != "" {
t.Errorf("Expected stdout to be empty, but got %q", stdout.String())
}
if stderr.String() != "" {
t.Errorf("Expected stderr to be empty, but got %q", stderr.String())
}

// Check that chart was actually pushed
obj, err := mc.StatObject(name, key, minio.StatObjectOptions{})
if err != nil {
t.Errorf("Unexpected error: %v", err)
}

if obj.Key != key {
t.Errorf("Expected key to be %q but got %q", key, obj.Key)
}
if obj.ContentType != contentType {
t.Errorf("Expected ContentType to be %q but got %q", contentType, obj.ContentType)
}
}

func TestPushDryRun(t *testing.T) {
t.Log("Test push action with --dry-run flag")

Expand Down

0 comments on commit d0d1ef9

Please sign in to comment.