Merge pull request #4024 from adamreese/dev-v3-golden

ref(tests): use golden files for testing command output
pull/4027/head
Adam Reese 7 years ago committed by GitHub
commit 4015a653f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

8
Gopkg.lock generated

@ -384,6 +384,12 @@
revision = "5f041e8faa004a95c88a202771f4cc3e991971e6" revision = "5f041e8faa004a95c88a202771f4cc3e991971e6"
version = "v2.0.1" version = "v2.0.1"
[[projects]]
name = "github.com/pkg/errors"
packages = ["."]
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
version = "v0.8.0"
[[projects]] [[projects]]
name = "github.com/pmezard/go-difflib" name = "github.com/pmezard/go-difflib"
packages = ["difflib"] packages = ["difflib"]
@ -1071,6 +1077,6 @@
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "82526354be9627a0e3796098ee9bed433a3e7958495f65e371ecc27d8c71c111" inputs-digest = "4a0464d8de132c8a733f50549ad69e663b992e12537b58626302dc5dd14cd3f0"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

@ -17,6 +17,7 @@ limitations under the License.
package main package main
import ( import (
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
@ -46,8 +47,7 @@ func TestCreateCmd(t *testing.T) {
defer os.Chdir(pwd) defer os.Chdir(pwd)
// Run a create // Run a create
cmd := newCreateCmd(ioutil.Discard) if _, err := executeCommand(nil, "create "+cname); err != nil {
if err := cmd.RunE(cmd, []string{cname}); err != nil {
t.Errorf("Failed to run create: %s", err) t.Errorf("Failed to run create: %s", err)
return return
} }
@ -117,9 +117,7 @@ func TestCreateStarterCmd(t *testing.T) {
defer os.Chdir(pwd) defer os.Chdir(pwd)
// Run a create // Run a create
cmd := newCreateCmd(ioutil.Discard) if _, err := executeCommand(nil, fmt.Sprintf("--home=%s create --starter=starterchart %s", thome, cname)); err != nil {
cmd.ParseFlags([]string{"--starter", "starterchart"})
if err := cmd.RunE(cmd, []string{cname}); err != nil {
t.Errorf("Failed to run create: %s", err) t.Errorf("Failed to run create: %s", err)
return return
} }

@ -25,41 +25,37 @@ import (
func TestDelete(t *testing.T) { func TestDelete(t *testing.T) {
resp := helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})
rels := []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})} rels := []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}
tests := []releaseCase{ tests := []releaseCase{
{ {
name: "basic delete", name: "basic delete",
cmd: "delete aeneas", cmd: "delete aeneas",
matches: `release "aeneas" deleted`, golden: "output/delete.txt",
resp: resp, rels: rels,
rels: rels,
}, },
{ {
name: "delete with timeout", name: "delete with timeout",
cmd: "delete aeneas --timeout 120", cmd: "delete aeneas --timeout 120",
matches: `release "aeneas" deleted`, golden: "output/delete-timeout.txt",
resp: resp, rels: rels,
rels: rels,
}, },
{ {
name: "delete without hooks", name: "delete without hooks",
cmd: "delete aeneas --no-hooks", cmd: "delete aeneas --no-hooks",
matches: `release "aeneas" deleted`, golden: "output/delete-no-hooks.txt",
resp: resp, rels: rels,
rels: rels,
}, },
{ {
name: "purge", name: "purge",
cmd: "delete aeneas --purge", cmd: "delete aeneas --purge",
matches: `release "aeneas" deleted`, golden: "output/delete-purge.txt",
resp: resp, rels: rels,
rels: rels,
}, },
{ {
name: "delete without release", name: "delete without release",
cmd: "delete", cmd: "delete",
golden: "output/delete-no-args.txt",
wantError: true, wantError: true,
}, },
} }

@ -121,11 +121,7 @@ func newDependencyListCmd(out io.Writer) *cobra.Command {
cp = args[0] cp = args[0]
} }
var err error dlc.chartpath = filepath.Clean(cp)
dlc.chartpath, err = filepath.Abs(cp)
if err != nil {
return err
}
return dlc.run() return dlc.run()
}, },
} }

@ -16,13 +16,11 @@ limitations under the License.
package main package main
import ( import (
"bytes" "fmt"
"os" "os"
"path/filepath"
"strings" "strings"
"testing" "testing"
"k8s.io/helm/pkg/helm/helmpath"
"k8s.io/helm/pkg/provenance" "k8s.io/helm/pkg/provenance"
"k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo"
"k8s.io/helm/pkg/repo/repotest" "k8s.io/helm/pkg/repo/repotest"
@ -53,32 +51,28 @@ func TestDependencyBuildCmd(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
out := bytes.NewBuffer(nil) cmd := fmt.Sprintf("--home=%s dependency build %s", hh, hh.Path(chartname))
dbc := &dependencyBuildCmd{out: out} out, err := executeCommand(nil, cmd)
dbc.helmhome = helmpath.Home(hh)
dbc.chartpath = filepath.Join(hh.String(), chartname)
// In the first pass, we basically want the same results as an update. // In the first pass, we basically want the same results as an update.
if err := dbc.run(); err != nil { if err != nil {
output := out.String() t.Logf("Output: %s", out)
t.Logf("Output: %s", output)
t.Fatal(err) t.Fatal(err)
} }
output := out.String() if !strings.Contains(out, `update from the "test" chart repository`) {
if !strings.Contains(output, `update from the "test" chart repository`) { t.Errorf("Repo did not get updated\n%s", out)
t.Errorf("Repo did not get updated\n%s", output)
} }
// Make sure the actual file got downloaded. // Make sure the actual file got downloaded.
expect := filepath.Join(hh.String(), chartname, "charts/reqtest-0.1.0.tgz") expect := hh.Path(chartname, "charts/reqtest-0.1.0.tgz")
if _, err := os.Stat(expect); err != nil { if _, err := os.Stat(expect); err != nil {
t.Fatal(err) t.Fatal(err)
} }
// In the second pass, we want to remove the chart's request dependency, // In the second pass, we want to remove the chart's request dependency,
// then see if it restores from the lock. // then see if it restores from the lock.
lockfile := filepath.Join(hh.String(), chartname, "requirements.lock") lockfile := hh.Path(chartname, "requirements.lock")
if _, err := os.Stat(lockfile); err != nil { if _, err := os.Stat(lockfile); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -86,14 +80,14 @@ func TestDependencyBuildCmd(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if err := dbc.run(); err != nil { out, err = executeCommand(nil, cmd)
output := out.String() if err != nil {
t.Logf("Output: %s", output) t.Logf("Output: %s", out)
t.Fatal(err) t.Fatal(err)
} }
// Now repeat the test that the dependency exists. // Now repeat the test that the dependency exists.
expect = filepath.Join(hh.String(), chartname, "charts/reqtest-0.1.0.tgz") expect = hh.Path(chartname, "charts/reqtest-0.1.0.tgz")
if _, err := os.Stat(expect); err != nil { if _, err := os.Stat(expect); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -104,7 +98,7 @@ func TestDependencyBuildCmd(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
i, err := repo.LoadIndexFile(dbc.helmhome.CacheIndex("test")) i, err := repo.LoadIndexFile(hh.CacheIndex("test"))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -116,5 +110,4 @@ func TestDependencyBuildCmd(t *testing.T) {
if v := reqver.Version; v != "0.1.0" { if v := reqver.Version; v != "0.1.0" {
t.Errorf("mismatched versions. Expected %q, got %q", "0.1.0", v) t.Errorf("mismatched versions. Expected %q, got %q", "0.1.0", v)
} }
} }

@ -20,31 +20,23 @@ import (
) )
func TestDependencyListCmd(t *testing.T) { func TestDependencyListCmd(t *testing.T) {
tests := []releaseCase{{
tests := []releaseCase{ name: "No such chart",
{ cmd: "dependency list /no/such/chart",
name: "No such chart", golden: "output/dependency-list-no-chart.txt",
cmd: "dependency list /no/such/chart", wantError: true,
wantError: true, }, {
}, name: "No requirements.yaml",
{ cmd: "dependency list testdata/testcharts/alpine",
name: "No requirements.yaml", golden: "output/dependency-list-no-requirements.txt",
cmd: "dependency list testdata/testcharts/alpine", }, {
matches: "WARNING: no requirements at ", name: "Requirements in chart dir",
}, cmd: "dependency list testdata/testcharts/reqtest",
{ golden: "output/dependency-list.txt",
name: "Requirements in chart dir", }, {
cmd: "dependency list testdata/testcharts/reqtest", name: "Requirements in chart archive",
matches: "NAME \tVERSION\tREPOSITORY \tSTATUS \n" + cmd: "dependency list testdata/testcharts/reqtest-0.1.0.tgz",
"reqsubchart \t0.1.0 \thttps://example.com/charts\tunpacked\n" + golden: "output/dependency-list-archive.txt",
"reqsubchart2\t0.2.0 \thttps://example.com/charts\tunpacked\n" + }}
"reqsubchart3\t>=0.1.0\thttps://example.com/charts\tok \n\n",
},
{
name: "Requirements in chart archive",
cmd: "dependency list testdata/testcharts/reqtest-0.1.0.tgz",
matches: "NAME \tVERSION\tREPOSITORY \tSTATUS \nreqsubchart \t0.1.0 \thttps://example.com/charts\tmissing\nreqsubchart2\t0.2.0 \thttps://example.com/charts\tmissing\n",
},
}
testReleaseCmd(t, tests) testReleaseCmd(t, tests)
} }

@ -20,6 +20,7 @@ import (
"path/filepath" "path/filepath"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/helm/pkg/downloader" "k8s.io/helm/pkg/downloader"
"k8s.io/helm/pkg/getter" "k8s.io/helm/pkg/getter"
"k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/helmpath"

@ -17,6 +17,7 @@ package main
import ( import (
"bytes" "bytes"
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
@ -60,25 +61,19 @@ func TestDependencyUpdateCmd(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
out := bytes.NewBuffer(nil) out, err := executeCommand(nil, fmt.Sprintf("--home=%s dependency update %s", hh, hh.Path(chartname)))
duc := &dependencyUpdateCmd{out: out} if err != nil {
duc.helmhome = helmpath.Home(hh) t.Logf("Output: %s", out)
duc.chartpath = filepath.Join(hh.String(), chartname)
if err := duc.run(); err != nil {
output := out.String()
t.Logf("Output: %s", output)
t.Fatal(err) t.Fatal(err)
} }
output := out.String()
// This is written directly to stdout, so we have to capture as is. // This is written directly to stdout, so we have to capture as is.
if !strings.Contains(output, `update from the "test" chart repository`) { if !strings.Contains(out, `update from the "test" chart repository`) {
t.Errorf("Repo did not get updated\n%s", output) t.Errorf("Repo did not get updated\n%s", out)
} }
// Make sure the actual file got downloaded. // Make sure the actual file got downloaded.
expect := filepath.Join(hh.String(), chartname, "charts/reqtest-0.1.0.tgz") expect := hh.Path(chartname, "charts/reqtest-0.1.0.tgz")
if _, err := os.Stat(expect); err != nil { if _, err := os.Stat(expect); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -88,7 +83,7 @@ func TestDependencyUpdateCmd(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
i, err := repo.LoadIndexFile(duc.helmhome.CacheIndex("test")) i, err := repo.LoadIndexFile(hh.CacheIndex("test"))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -106,23 +101,24 @@ func TestDependencyUpdateCmd(t *testing.T) {
{Name: "compressedchart", Version: "0.3.0", Repository: srv.URL()}, {Name: "compressedchart", Version: "0.3.0", Repository: srv.URL()},
}, },
} }
dir := filepath.Join(hh.String(), chartname) dir := hh.Path(chartname)
if err := writeRequirements(dir, reqfile); err != nil { if err := writeRequirements(dir, reqfile); err != nil {
t.Fatal(err) t.Fatal(err)
} }
if err := duc.run(); err != nil {
output := out.String() out, err = executeCommand(nil, fmt.Sprintf("--home=%s dependency update %s", hh, hh.Path(chartname)))
t.Logf("Output: %s", output) if err != nil {
t.Logf("Output: %s", out)
t.Fatal(err) t.Fatal(err)
} }
// In this second run, we should see compressedchart-0.3.0.tgz, and not // In this second run, we should see compressedchart-0.3.0.tgz, and not
// the 0.1.0 version. // the 0.1.0 version.
expect = filepath.Join(hh.String(), chartname, "charts/compressedchart-0.3.0.tgz") expect = hh.Path(chartname, "charts/compressedchart-0.3.0.tgz")
if _, err := os.Stat(expect); err != nil { if _, err := os.Stat(expect); err != nil {
t.Fatalf("Expected %q: %s", expect, err) t.Fatalf("Expected %q: %s", expect, err)
} }
dontExpect := filepath.Join(hh.String(), chartname, "charts/compressedchart-0.1.0.tgz") dontExpect := hh.Path(chartname, "charts/compressedchart-0.1.0.tgz")
if _, err := os.Stat(dontExpect); err == nil { if _, err := os.Stat(dontExpect); err == nil {
t.Fatalf("Unexpected %q", dontExpect) t.Fatalf("Unexpected %q", dontExpect)
} }
@ -155,20 +151,14 @@ func TestDependencyUpdateCmd_SkipRefresh(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
out := bytes.NewBuffer(nil) out, err := executeCommand(nil, fmt.Sprintf("--home=%s dependency update --skip-refresh %s", hh, hh.Path(chartname)))
duc := &dependencyUpdateCmd{out: out} if err == nil {
duc.helmhome = helmpath.Home(hh)
duc.chartpath = filepath.Join(hh.String(), chartname)
duc.skipRefresh = true
if err := duc.run(); err == nil {
t.Fatal("Expected failure to find the repo with skipRefresh") t.Fatal("Expected failure to find the repo with skipRefresh")
} }
output := out.String()
// This is written directly to stdout, so we have to capture as is. // This is written directly to stdout, so we have to capture as is.
if strings.Contains(output, `update from the "test" chart repository`) { if strings.Contains(out, `update from the "test" chart repository`) {
t.Errorf("Repo was unexpectedly updated\n%s", output) t.Errorf("Repo was unexpectedly updated\n%s", out)
} }
} }
@ -202,7 +192,7 @@ func TestDependencyUpdateCmd_DontDeleteOldChartsOnError(t *testing.T) {
out := bytes.NewBuffer(nil) out := bytes.NewBuffer(nil)
duc := &dependencyUpdateCmd{out: out} duc := &dependencyUpdateCmd{out: out}
duc.helmhome = helmpath.Home(hh) duc.helmhome = helmpath.Home(hh)
duc.chartpath = filepath.Join(hh.String(), chartname) duc.chartpath = hh.Path(chartname)
if err := duc.run(); err != nil { if err := duc.run(); err != nil {
output := out.String() output := out.String()

@ -17,11 +17,11 @@ limitations under the License.
package main package main
import ( import (
"bytes"
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
"strings"
"testing" "testing"
"k8s.io/helm/pkg/repo/repotest" "k8s.io/helm/pkg/repo/repotest"
@ -45,9 +45,8 @@ func TestFetchCmd(t *testing.T) {
// all flags will get "--home=TMDIR -d outdir" appended. // all flags will get "--home=TMDIR -d outdir" appended.
tests := []struct { tests := []struct {
name string name string
chart string args []string
flags []string wantError bool
fail bool
failExpect string failExpect string
expectFile string expectFile string
expectDir bool expectDir bool
@ -55,82 +54,72 @@ func TestFetchCmd(t *testing.T) {
}{ }{
{ {
name: "Basic chart fetch", name: "Basic chart fetch",
chart: "test/signtest", args: []string{"test/signtest"},
expectFile: "./signtest-0.1.0.tgz", expectFile: "./signtest-0.1.0.tgz",
}, },
{ {
name: "Chart fetch with version", name: "Chart fetch with version",
chart: "test/signtest", args: []string{"test/signtest --version=0.1.0"},
flags: []string{"--version", "0.1.0"},
expectFile: "./signtest-0.1.0.tgz", expectFile: "./signtest-0.1.0.tgz",
}, },
{ {
name: "Fail chart fetch with non-existent version", name: "Fail chart fetch with non-existent version",
chart: "test/signtest", args: []string{"test/signtest --version=99.1.0"},
flags: []string{"--version", "99.1.0"}, wantError: true,
fail: true,
failExpect: "no such chart", failExpect: "no such chart",
}, },
{ {
name: "Fail fetching non-existent chart", name: "Fail fetching non-existent chart",
chart: "test/nosuchthing", args: []string{"test/nosuchthing"},
failExpect: "Failed to fetch", failExpect: "Failed to fetch",
fail: true, wantError: true,
}, },
{ {
name: "Fetch and verify", name: "Fetch and verify",
chart: "test/signtest", args: []string{"test/signtest --verify --keyring testdata/helm-test-key.pub"},
flags: []string{"--verify", "--keyring", "testdata/helm-test-key.pub"},
expectFile: "./signtest-0.1.0.tgz", expectFile: "./signtest-0.1.0.tgz",
expectVerify: true, expectVerify: true,
}, },
{ {
name: "Fetch and fail verify", name: "Fetch and fail verify",
chart: "test/reqtest", args: []string{"test/reqtest --verify --keyring testdata/helm-test-key.pub"},
flags: []string{"--verify", "--keyring", "testdata/helm-test-key.pub"},
failExpect: "Failed to fetch provenance", failExpect: "Failed to fetch provenance",
fail: true, wantError: true,
}, },
{ {
name: "Fetch and untar", name: "Fetch and untar",
chart: "test/signtest", args: []string{"test/signtest --untar --untardir signtest"},
flags: []string{"--untar", "--untardir", "signtest"},
expectFile: "./signtest", expectFile: "./signtest",
expectDir: true, expectDir: true,
}, },
{ {
name: "Fetch, verify, untar", name: "Fetch, verify, untar",
chart: "test/signtest", args: []string{"test/signtest --verify --keyring=testdata/helm-test-key.pub --untar --untardir signtest"},
flags: []string{"--verify", "--keyring", "testdata/helm-test-key.pub", "--untar", "--untardir", "signtest"},
expectFile: "./signtest", expectFile: "./signtest",
expectDir: true, expectDir: true,
expectVerify: true, expectVerify: true,
}, },
{ {
name: "Chart fetch using repo URL", name: "Chart fetch using repo URL",
chart: "signtest",
expectFile: "./signtest-0.1.0.tgz", expectFile: "./signtest-0.1.0.tgz",
flags: []string{"--repo", srv.URL()}, args: []string{"signtest --repo", srv.URL()},
}, },
{ {
name: "Fail fetching non-existent chart on repo URL", name: "Fail fetching non-existent chart on repo URL",
chart: "someChart", args: []string{"someChart --repo", srv.URL()},
flags: []string{"--repo", srv.URL()},
failExpect: "Failed to fetch chart", failExpect: "Failed to fetch chart",
fail: true, wantError: true,
}, },
{ {
name: "Specific version chart fetch using repo URL", name: "Specific version chart fetch using repo URL",
chart: "signtest",
expectFile: "./signtest-0.1.0.tgz", expectFile: "./signtest-0.1.0.tgz",
flags: []string{"--repo", srv.URL(), "--version", "0.1.0"}, args: []string{"signtest --version=0.1.0 --repo", srv.URL()},
}, },
{ {
name: "Specific version chart fetch using repo URL", name: "Specific version chart fetch using repo URL",
chart: "signtest", args: []string{"signtest --version=0.2.0 --repo", srv.URL()},
flags: []string{"--repo", srv.URL(), "--version", "0.2.0"},
failExpect: "Failed to fetch chart version", failExpect: "Failed to fetch chart version",
fail: true, wantError: true,
}, },
} }
@ -146,24 +135,23 @@ func TestFetchCmd(t *testing.T) {
os.RemoveAll(outdir) os.RemoveAll(outdir)
os.Mkdir(outdir, 0755) os.Mkdir(outdir, 0755)
buf := bytes.NewBuffer(nil) cmd := strings.Join(append(tt.args, "-d", outdir, "--home", hh.String()), " ")
cmd := newFetchCmd(buf) out, err := executeCommand(nil, "fetch "+cmd)
tt.flags = append(tt.flags, "-d", outdir) if err != nil {
cmd.ParseFlags(tt.flags) if tt.wantError {
if err := cmd.RunE(cmd, []string{tt.chart}); err != nil {
if tt.fail {
continue continue
} }
t.Errorf("%q reported error: %s", tt.name, err) t.Errorf("%q reported error: %s", tt.name, err)
continue continue
} }
if tt.expectVerify { if tt.expectVerify {
pointerAddressPattern := "0[xX][A-Fa-f0-9]+" pointerAddressPattern := "0[xX][A-Fa-f0-9]+"
sha256Pattern := "[A-Fa-f0-9]{64}" sha256Pattern := "[A-Fa-f0-9]{64}"
verificationRegex := regexp.MustCompile( verificationRegex := regexp.MustCompile(
fmt.Sprintf("Verification: &{%s sha256:%s signtest-0.1.0.tgz}\n", pointerAddressPattern, sha256Pattern)) fmt.Sprintf("Verification: &{%s sha256:%s signtest-0.1.0.tgz}\n", pointerAddressPattern, sha256Pattern))
if !verificationRegex.MatchString(buf.String()) { if !verificationRegex.MatchString(out) {
t.Errorf("%q: expected match for regex %s, got %s", tt.name, verificationRegex, buf.String()) t.Errorf("%q: expected match for regex %s, got %s", tt.name, verificationRegex, out)
} }
} }

@ -24,19 +24,16 @@ import (
) )
func TestGetHooks(t *testing.T) { func TestGetHooks(t *testing.T) {
tests := []releaseCase{ tests := []releaseCase{{
{ name: "get hooks with release",
name: "get hooks with release", cmd: "get hooks aeneas",
cmd: "get hooks aeneas", golden: "output/get-hooks.txt",
matches: helm.MockHookTemplate, rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})},
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}), }, {
rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}, name: "get hooks without args",
}, cmd: "get hooks",
{ golden: "output/get-hooks-no-args.txt",
name: "get hooks without args", wantError: true,
cmd: "get hooks", }}
wantError: true,
},
}
testReleaseCmd(t, tests) testReleaseCmd(t, tests)
} }

@ -24,19 +24,16 @@ import (
) )
func TestGetManifest(t *testing.T) { func TestGetManifest(t *testing.T) {
tests := []releaseCase{ tests := []releaseCase{{
{ name: "get manifest with release",
name: "get manifest with release", cmd: "get manifest juno",
cmd: "get manifest juno", golden: "output/get-manifest.txt",
matches: helm.MockManifest, rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "juno"})},
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "juno"}), }, {
rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "juno"})}, name: "get manifest without args",
}, cmd: "get manifest",
{ golden: "output/get-manifest-no-args.txt",
name: "get manifest without args", wantError: true,
cmd: "get manifest", }}
wantError: true,
},
}
testReleaseCmd(t, tests) testReleaseCmd(t, tests)
} }

@ -24,19 +24,16 @@ import (
) )
func TestGetCmd(t *testing.T) { func TestGetCmd(t *testing.T) {
tests := []releaseCase{ tests := []releaseCase{{
{ name: "get with a release",
name: "get with a release", cmd: "get thomas-guide",
cmd: "get thomas-guide", golden: "output/get-release.txt",
matches: "REVISION: 1\nRELEASED: (.*)\nCHART: foo-0.1.0-beta.1\nUSER-SUPPLIED VALUES:\nname: \"value\"\nCOMPUTED VALUES:\nname: value\n\nHOOKS:\n---\n# pre-install-hook\n" + helm.MockHookTemplate + "\nMANIFEST:", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"})},
rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"})}, }, {
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), name: "get requires release name arg",
}, cmd: "get",
{ golden: "output/get-no-args.txt",
name: "get requires release name arg", wantError: true,
cmd: "get", }}
wantError: true,
},
}
testReleaseCmd(t, tests) testReleaseCmd(t, tests)
} }

@ -24,19 +24,16 @@ import (
) )
func TestGetValuesCmd(t *testing.T) { func TestGetValuesCmd(t *testing.T) {
tests := []releaseCase{ tests := []releaseCase{{
{ name: "get values with a release",
name: "get values with a release", cmd: "get values thomas-guide",
cmd: "get values thomas-guide", golden: "output/get-values.txt",
matches: "name: \"value\"", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"})},
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), }, {
rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"})}, name: "get values requires release name arg",
}, cmd: "get values",
{ golden: "output/get-values-args.txt",
name: "get values requires release name arg", wantError: true,
cmd: "get values", }}
wantError: true,
},
}
testReleaseCmd(t, tests) testReleaseCmd(t, tests)
} }

@ -22,13 +22,13 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"regexp"
"strings" "strings"
"testing" "testing"
shellwords "github.com/mattn/go-shellwords" shellwords "github.com/mattn/go-shellwords"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/helm/internal/test"
"k8s.io/helm/pkg/hapi/release" "k8s.io/helm/pkg/hapi/release"
"k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/helmpath"
@ -56,19 +56,19 @@ func executeCommandC(client helm.Interface, cmd string) (*cobra.Command, string,
} }
func testReleaseCmd(t *testing.T, tests []releaseCase) { func testReleaseCmd(t *testing.T, tests []releaseCase) {
t.Helper()
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
c := &helm.FakeClient{ c := &helm.FakeClient{
Rels: tt.rels, Rels: tt.rels,
Responses: tt.responses, TestRunStatus: tt.testRunStatus,
} }
out, err := executeCommand(c, tt.cmd) out, err := executeCommand(c, tt.cmd)
if (err != nil) != tt.wantError { if (err != nil) != tt.wantError {
t.Errorf("expected error, got '%v'", err) t.Errorf("expected error, got '%v'", err)
} }
re := regexp.MustCompile(tt.matches) if tt.golden != "" {
if !re.MatchString(out) { test.AssertGoldenString(t, out, tt.golden)
t.Errorf("expected\n%q\ngot\n%q", tt.matches, out)
} }
}) })
} }
@ -76,15 +76,13 @@ func testReleaseCmd(t *testing.T, tests []releaseCase) {
// releaseCase describes a test case that works with releases. // releaseCase describes a test case that works with releases.
type releaseCase struct { type releaseCase struct {
name string name string
cmd string cmd string
// matches is the string to be matched. This supports regular expressions. golden string
matches string
wantError bool wantError bool
resp *release.Release
// Rels are the available releases at the start of the test. // Rels are the available releases at the start of the test.
rels []*release.Release rels []*release.Release
responses map[string]release.TestRunStatus testRunStatus map[string]release.TestRunStatus
} }
// tempHelmHome sets up a Helm Home in a temp dir. // tempHelmHome sets up a Helm Home in a temp dir.
@ -99,7 +97,7 @@ func tempHelmHome(t *testing.T) (helmpath.Home, error) {
} }
settings.Home = helmpath.Home(dir) settings.Home = helmpath.Home(dir)
if err := ensureTestHome(settings.Home, t); err != nil { if err := ensureTestHome(t, settings.Home); err != nil {
return helmpath.Home("n/"), err return helmpath.Home("n/"), err
} }
settings.Home = oldhome settings.Home = oldhome
@ -109,20 +107,22 @@ func tempHelmHome(t *testing.T) (helmpath.Home, error) {
// ensureTestHome creates a home directory like ensureHome, but without remote references. // ensureTestHome creates a home directory like ensureHome, but without remote references.
// //
// t is used only for logging. // t is used only for logging.
func ensureTestHome(home helmpath.Home, t *testing.T) error { func ensureTestHome(t *testing.T, home helmpath.Home) error {
configDirectories := []string{home.String(), home.Repository(), home.Cache(), home.Plugins(), home.Starters()} t.Helper()
for _, p := range configDirectories { for _, p := range []string{
if fi, err := os.Stat(p); err != nil { home.String(),
if err := os.MkdirAll(p, 0755); err != nil { home.Repository(),
return fmt.Errorf("Could not create %s: %s", p, err) home.Cache(),
} home.Plugins(),
} else if !fi.IsDir() { home.Starters(),
return fmt.Errorf("%s must be a directory", p) } {
if err := os.MkdirAll(p, 0755); err != nil {
return fmt.Errorf("Could not create %s: %s", p, err)
} }
} }
repoFile := home.RepositoryFile() repoFile := home.RepositoryFile()
if fi, err := os.Stat(repoFile); err != nil { if _, err := os.Stat(repoFile); err != nil {
rf := repo.NewRepoFile() rf := repo.NewRepoFile()
rf.Add(&repo.Entry{ rf.Add(&repo.Entry{
Name: "charts", Name: "charts",
@ -132,8 +132,6 @@ func ensureTestHome(home helmpath.Home, t *testing.T) error {
if err := rf.WriteFile(repoFile, 0644); err != nil { if err := rf.WriteFile(repoFile, 0644); err != nil {
return err return err
} }
} else if fi.IsDir() {
return fmt.Errorf("%s must be a file, not a directory", repoFile)
} }
if r, err := repo.LoadRepositoriesFile(repoFile); err == repo.ErrRepoOutOfDate { if r, err := repo.LoadRepositoriesFile(repoFile); err == repo.ErrRepoOutOfDate {
t.Log("Updating repository file format...") t.Log("Updating repository file format...")

@ -32,45 +32,40 @@ func TestHistoryCmd(t *testing.T) {
}) })
} }
tests := []releaseCase{ tests := []releaseCase{{
{ name: "get history for release",
name: "get history for release", cmd: "history angry-bird",
cmd: "history angry-bird", rels: []*rpb.Release{
rels: []*rpb.Release{ mk("angry-bird", 4, rpb.StatusDeployed),
mk("angry-bird", 4, rpb.StatusDeployed), mk("angry-bird", 3, rpb.StatusSuperseded),
mk("angry-bird", 3, rpb.StatusSuperseded), mk("angry-bird", 2, rpb.StatusSuperseded),
mk("angry-bird", 2, rpb.StatusSuperseded), mk("angry-bird", 1, rpb.StatusSuperseded),
mk("angry-bird", 1, rpb.StatusSuperseded),
},
matches: `REVISION\s+UPDATED\s+STATUS\s+CHART\s+DESCRIPTION \n1\s+(.*)\s+superseded\s+foo-0.1.0-beta.1\s+Release mock\n2(.*)superseded\s+foo-0.1.0-beta.1\s+Release mock\n3(.*)superseded\s+foo-0.1.0-beta.1\s+Release mock\n4(.*)deployed\s+foo-0.1.0-beta.1\s+Release mock\n`,
}, },
{ golden: "output/history.txt",
name: "get history with max limit set", }, {
cmd: "history angry-bird --max 2", name: "get history with max limit set",
rels: []*rpb.Release{ cmd: "history angry-bird --max 2",
mk("angry-bird", 4, rpb.StatusDeployed), rels: []*rpb.Release{
mk("angry-bird", 3, rpb.StatusSuperseded), mk("angry-bird", 4, rpb.StatusDeployed),
}, mk("angry-bird", 3, rpb.StatusSuperseded),
matches: `REVISION\s+UPDATED\s+STATUS\s+CHART\s+DESCRIPTION \n3\s+(.*)\s+superseded\s+foo-0.1.0-beta.1\s+Release mock\n4\s+(.*)\s+deployed\s+foo-0.1.0-beta.1\s+Release mock\n`,
}, },
{ golden: "output/history-limit.txt",
name: "get history with yaml output format", }, {
cmd: "history angry-bird --output yaml", name: "get history with yaml output format",
rels: []*rpb.Release{ cmd: "history angry-bird --output yaml",
mk("angry-bird", 4, rpb.StatusDeployed), rels: []*rpb.Release{
mk("angry-bird", 3, rpb.StatusSuperseded), mk("angry-bird", 4, rpb.StatusDeployed),
}, mk("angry-bird", 3, rpb.StatusSuperseded),
matches: "- chart: foo-0.1.0-beta.1\n description: Release mock\n revision: 3\n status: superseded\n updated: (.*)\n- chart: foo-0.1.0-beta.1\n description: Release mock\n revision: 4\n status: deployed\n updated: (.*)\n\n",
}, },
{ golden: "output/history.yaml",
name: "get history with json output format", }, {
cmd: "history angry-bird --output json", name: "get history with json output format",
rels: []*rpb.Release{ cmd: "history angry-bird --output json",
mk("angry-bird", 4, rpb.StatusDeployed), rels: []*rpb.Release{
mk("angry-bird", 3, rpb.StatusSuperseded), mk("angry-bird", 4, rpb.StatusDeployed),
}, mk("angry-bird", 3, rpb.StatusSuperseded),
matches: `[{"revision":3,"updated":".*","status":"superseded","chart":"foo\-0.1.0-beta.1","description":"Release mock"},{"revision":4,"updated":".*","status":"deployed","chart":"foo\-0.1.0-beta.1","description":"Release mock"}]\n`,
}, },
} golden: "output/history.json",
}}
testReleaseCmd(t, tests) testReleaseCmd(t, tests)
} }

@ -20,87 +20,76 @@ import (
"reflect" "reflect"
"regexp" "regexp"
"testing" "testing"
"k8s.io/helm/pkg/helm"
) )
func TestInstall(t *testing.T) { func TestInstall(t *testing.T) {
tests := []releaseCase{ tests := []releaseCase{
// Install, base case // Install, base case
{ {
name: "basic install", name: "basic install",
cmd: "install testdata/testcharts/alpine --name aeneas", cmd: "install testdata/testcharts/alpine --name aeneas",
matches: "aeneas", golden: "output/install.txt",
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}),
}, },
// Install, no hooks // Install, no hooks
{ {
name: "install without hooks", name: "install without hooks",
cmd: "install testdata/testcharts/alpine --name aeneas --no-hooks", cmd: "install testdata/testcharts/alpine --name aeneas --no-hooks",
matches: "aeneas", golden: "output/install-no-hooks.txt",
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}),
}, },
// Install, values from cli // Install, values from cli
{ {
name: "install with values", name: "install with values",
cmd: "install testdata/testcharts/alpine --name virgil --set foo=bar", cmd: "install testdata/testcharts/alpine --name virgil --set foo=bar",
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil"}), golden: "output/install-with-values.txt",
matches: "virgil",
}, },
// Install, values from cli via multiple --set // Install, values from cli via multiple --set
{ {
name: "install with multiple values", name: "install with multiple values",
cmd: "install testdata/testcharts/alpine --name virgil --set foo=bar --set bar=foo", cmd: "install testdata/testcharts/alpine --name virgil --set foo=bar --set bar=foo",
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil"}), golden: "output/install-with-multiple-values.txt",
matches: "virgil",
}, },
// Install, values from yaml // Install, values from yaml
{ {
name: "install with values", name: "install with values file",
cmd: "install testdata/testcharts/alpine --name virgil -f testdata/testcharts/alpine/extra_values.yaml", cmd: "install testdata/testcharts/alpine --name virgil -f testdata/testcharts/alpine/extra_values.yaml",
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil"}), golden: "output/install-with-values-file.txt",
matches: "virgil",
}, },
// Install, values from multiple yaml // Install, values from multiple yaml
{ {
name: "install with values", name: "install with values",
cmd: "install testdata/testcharts/alpine --name virgil -f testdata/testcharts/alpine/extra_values.yaml -f testdata/testcharts/alpine/more_values.yaml", cmd: "install testdata/testcharts/alpine --name virgil -f testdata/testcharts/alpine/extra_values.yaml -f testdata/testcharts/alpine/more_values.yaml",
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil"}), golden: "output/install-with-multiple-values-files.txt",
matches: "virgil",
}, },
// Install, no charts // Install, no charts
{ {
name: "install with no chart specified", name: "install with no chart specified",
cmd: "install", cmd: "install",
golden: "output/install-no-args.txt",
wantError: true, wantError: true,
}, },
// Install, re-use name // Install, re-use name
{ {
name: "install and replace release", name: "install and replace release",
cmd: "install testdata/testcharts/alpine --name aeneas --replace", cmd: "install testdata/testcharts/alpine --name aeneas --replace",
matches: "aeneas", golden: "output/install-and-replace.txt",
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}),
}, },
// Install, with timeout // Install, with timeout
{ {
name: "install with a timeout", name: "install with a timeout",
cmd: "install testdata/testcharts/alpine --name foobar --timeout 120", cmd: "install testdata/testcharts/alpine --name foobar --timeout 120",
matches: "foobar", golden: "output/install-with-timeout.txt",
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "foobar"}),
}, },
// Install, with wait // Install, with wait
{ {
name: "install with a wait", name: "install with a wait",
cmd: "install testdata/testcharts/alpine --name apollo --wait", cmd: "install testdata/testcharts/alpine --name apollo --wait",
matches: "apollo", golden: "output/install-with-wait.txt",
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "apollo"}),
}, },
// Install, using the name-template // Install, using the name-template
{ {
name: "install with name-template", name: "install with name-template",
cmd: "install testdata/testcharts/alpine --name-template '{{upper \"foobar\"}}'", cmd: "install testdata/testcharts/alpine --name-template '{{upper \"foobar\"}}'",
matches: "FOOBAR", golden: "output/install-name-template.txt",
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "FOOBAR"}),
}, },
// Install, perform chart verification along the way. // Install, perform chart verification along the way.
{ {

@ -115,14 +115,14 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command {
} }
func (l *listCmd) run() error { func (l *listCmd) run() error {
sortBy := hapi.ListSortName sortBy := hapi.SortByName
if l.byDate { if l.byDate {
sortBy = hapi.ListSortLastReleased sortBy = hapi.SortByLastReleased
} }
sortOrder := hapi.ListSortAsc sortOrder := hapi.SortAsc
if l.sortDesc { if l.sortDesc {
sortOrder = hapi.ListSortDesc sortOrder = hapi.SortDesc
} }
stats := l.statusCodes() stats := l.statusCodes()

@ -24,103 +24,92 @@ import (
) )
func TestListCmd(t *testing.T) { func TestListCmd(t *testing.T) {
tests := []releaseCase{ tests := []releaseCase{{
{ name: "with a release",
name: "with a release", cmd: "list",
cmd: "list", rels: []*release.Release{
rels: []*release.Release{ helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}),
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}),
},
matches: "thomas-guide",
}, },
{ golden: "output/list-with-release.txt",
name: "list", }, {
cmd: "list", name: "list",
rels: []*release.Release{ cmd: "list",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}), rels: []*release.Release{
}, helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}),
matches: `NAME\s+REVISION\s+UPDATED\s+STATUS\s+CHART\s+NAMESPACE\natlas\s+1\s+(.*)\s+deployed\s+foo-0.1.0-beta.1\s+default`,
}, },
{ golden: "output/list.txt",
name: "list, one deployed, one failed", }, {
cmd: "list -q", name: "list, one deployed, one failed",
rels: []*release.Release{ cmd: "list -q",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusFailed}), rels: []*release.Release{
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusFailed}),
}, helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
matches: "thomas-guide\natlas-guide",
}, },
{ golden: "output/list-with-failed.txt",
name: "with a release, multiple flags", }, {
cmd: "list --deleted --deployed --failed -q", name: "with a release, multiple flags",
rels: []*release.Release{ cmd: "list --deleted --deployed --failed -q",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleted}), rels: []*release.Release{
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleted}),
}, helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
// Note: We're really only testing that the flags parsed correctly. Which results are returned
// depends on the backend. And until pkg/helm is done, we can't mock this.
matches: "thomas-guide\natlas-guide",
}, },
{ // Note: We're really only testing that the flags parsed correctly. Which results are returned
name: "with a release, multiple flags", // depends on the backend. And until pkg/helm is done, we can't mock this.
cmd: "list --all -q", golden: "output/list-with-mulitple-flags.txt",
rels: []*release.Release{ }, {
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleted}), name: "with a release, multiple flags",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}), cmd: "list --all -q",
}, rels: []*release.Release{
// See note on previous test. helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleted}),
matches: "thomas-guide\natlas-guide", helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
}, },
{ // See note on previous test.
name: "with a release, multiple flags, deleting", golden: "output/list-with-mulitple-flags2.txt",
cmd: "list --all -q", }, {
rels: []*release.Release{ name: "with a release, multiple flags, deleting",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleting}), cmd: "list --all -q",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}), rels: []*release.Release{
}, helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleting}),
// See note on previous test. helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
matches: "thomas-guide\natlas-guide",
}, },
{ // See note on previous test.
name: "namespace defined, multiple flags", golden: "output/list-with-mulitple-flags-deleting.txt",
cmd: "list --all -q --namespace test123", }, {
rels: []*release.Release{ name: "namespace defined, multiple flags",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Namespace: "test123"}), cmd: "list --all -q --namespace test123",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Namespace: "test321"}), rels: []*release.Release{
}, helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Namespace: "test123"}),
// See note on previous test. helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Namespace: "test321"}),
matches: "thomas-guide",
}, },
{ // See note on previous test.
name: "with a pending release, multiple flags", golden: "output/list-with-mulitple-flags-namespaced.txt",
cmd: "list --all -q", }, {
rels: []*release.Release{ name: "with a pending release, multiple flags",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusPendingInstall}), cmd: "list --all -q",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}), rels: []*release.Release{
}, helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusPendingInstall}),
matches: "thomas-guide\natlas-guide", helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
}, },
{ golden: "output/list-with-mulitple-flags-pending.txt",
name: "with a pending release, pending flag", }, {
cmd: "list --pending -q", name: "with a pending release, pending flag",
rels: []*release.Release{ cmd: "list --pending -q",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusPendingInstall}), rels: []*release.Release{
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "wild-idea", Status: release.StatusPendingUpgrade}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusPendingInstall}),
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-maps", Status: release.StatusPendingRollback}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "wild-idea", Status: release.StatusPendingUpgrade}),
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-maps", Status: release.StatusPendingRollback}),
}, helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
matches: "thomas-guide\nwild-idea\ncrazy-maps",
}, },
{ golden: "output/list-with-pending.txt",
name: "with old releases", }, {
cmd: "list", name: "with old releases",
rels: []*release.Release{ cmd: "list",
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), rels: []*release.Release{
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusFailed}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}),
}, helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusFailed}),
matches: "thomas-guide",
}, },
} golden: "output/list-with-old-releases.txt",
}}
testReleaseCmd(t, tests) testReleaseCmd(t, tests)
} }

@ -151,7 +151,7 @@ func TestPackage(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
ensureTestHome(helmpath.Home(tmp), t) ensureTestHome(t, helmpath.Home(tmp))
cleanup := resetEnv() cleanup := resetEnv()
defer func() { defer func() {
os.Chdir(origDir) os.Chdir(origDir)

@ -23,49 +23,44 @@ import (
) )
func TestReleaseTesting(t *testing.T) { func TestReleaseTesting(t *testing.T) {
tests := []releaseCase{ tests := []releaseCase{{
{ name: "basic test",
name: "basic test", cmd: "test example-release",
cmd: "test example-release", testRunStatus: map[string]release.TestRunStatus{"PASSED: green lights everywhere": release.TestRunSuccess},
responses: map[string]release.TestRunStatus{"PASSED: green lights everywhere": release.TestRunSuccess}, golden: "output/test.txt",
wantError: false, }, {
}, name: "test failure",
{ cmd: "test example-fail",
name: "test failure", testRunStatus: map[string]release.TestRunStatus{"FAILURE: red lights everywhere": release.TestRunFailure},
cmd: "test example-fail", wantError: true,
responses: map[string]release.TestRunStatus{"FAILURE: red lights everywhere": release.TestRunFailure}, golden: "output/test-failure.txt",
wantError: true, }, {
}, name: "test unknown",
{ cmd: "test example-unknown",
name: "test unknown", testRunStatus: map[string]release.TestRunStatus{"UNKNOWN: yellow lights everywhere": release.TestRunUnknown},
cmd: "test example-unknown", golden: "output/test-unknown.txt",
responses: map[string]release.TestRunStatus{"UNKNOWN: yellow lights everywhere": release.TestRunUnknown}, }, {
wantError: false, name: "test error",
}, cmd: "test example-error",
{ testRunStatus: map[string]release.TestRunStatus{"ERROR: yellow lights everywhere": release.TestRunFailure},
name: "test error", wantError: true,
cmd: "test example-error", golden: "output/test-error.txt",
responses: map[string]release.TestRunStatus{"ERROR: yellow lights everywhere": release.TestRunFailure}, }, {
wantError: true, name: "test running",
}, cmd: "test example-running",
{ testRunStatus: map[string]release.TestRunStatus{"RUNNING: things are happpeningggg": release.TestRunRunning},
name: "test running", golden: "output/test-running.txt",
cmd: "test example-running", }, {
responses: map[string]release.TestRunStatus{"RUNNING: things are happpeningggg": release.TestRunRunning}, name: "multiple tests example",
wantError: false, cmd: "test example-suite",
}, testRunStatus: map[string]release.TestRunStatus{
{ "RUNNING: things are happpeningggg": release.TestRunRunning,
name: "multiple tests example", "PASSED: party time": release.TestRunSuccess,
cmd: "test example-suite", "RUNNING: things are happening again": release.TestRunRunning,
responses: map[string]release.TestRunStatus{ "FAILURE: good thing u checked :)": release.TestRunFailure,
"RUNNING: things are happpeningggg": release.TestRunRunning, "RUNNING: things are happpeningggg yet again": release.TestRunRunning,
"PASSED: party time": release.TestRunSuccess, "PASSED: feel free to party again": release.TestRunSuccess},
"RUNNING: things are happening again": release.TestRunRunning, wantError: true,
"FAILURE: good thing u checked :)": release.TestRunFailure, }}
"RUNNING: things are happpeningggg yet again": release.TestRunRunning,
"PASSED: feel free to party again": release.TestRunSuccess},
wantError: true,
},
}
testReleaseCmd(t, tests) testReleaseCmd(t, tests)
} }

@ -25,8 +25,6 @@ import (
"k8s.io/helm/pkg/repo/repotest" "k8s.io/helm/pkg/repo/repotest"
) )
var testName = "test-name"
func TestRepoAddCmd(t *testing.T) { func TestRepoAddCmd(t *testing.T) {
srv, thome, err := repotest.NewTempServer("testdata/testserver/*.*") srv, thome, err := repotest.NewTempServer("testdata/testserver/*.*")
if err != nil { if err != nil {
@ -39,16 +37,16 @@ func TestRepoAddCmd(t *testing.T) {
os.RemoveAll(thome.String()) os.RemoveAll(thome.String())
cleanup() cleanup()
}() }()
if err := ensureTestHome(thome, t); err != nil { if err := ensureTestHome(t, thome); err != nil {
t.Fatal(err) t.Fatal(err)
} }
settings.Home = thome settings.Home = thome
tests := []releaseCase{{ tests := []releaseCase{{
name: "add a repository", name: "add a repository",
cmd: fmt.Sprintf("repo add %s %s --home %s", testName, srv.URL(), thome), cmd: fmt.Sprintf("repo add test-name %s --home %s", srv.URL(), thome),
matches: "\"" + testName + "\" has been added to your repositories", golden: "output/repo-add.txt",
}} }}
testReleaseCmd(t, tests) testReleaseCmd(t, tests)
@ -67,13 +65,15 @@ func TestRepoAdd(t *testing.T) {
os.RemoveAll(thome.String()) os.RemoveAll(thome.String())
cleanup() cleanup()
}() }()
if err := ensureTestHome(hh, t); err != nil { if err := ensureTestHome(t, hh); err != nil {
t.Fatal(err) t.Fatal(err)
} }
settings.Home = thome settings.Home = thome
if err := addRepository(testName, ts.URL(), "", "", hh, "", "", "", true); err != nil { const testRepoName = "test-name"
if err := addRepository(testRepoName, ts.URL(), "", "", hh, "", "", "", true); err != nil {
t.Error(err) t.Error(err)
} }
@ -82,15 +82,15 @@ func TestRepoAdd(t *testing.T) {
t.Error(err) t.Error(err)
} }
if !f.Has(testName) { if !f.Has(testRepoName) {
t.Errorf("%s was not successfully inserted into %s", testName, hh.RepositoryFile()) t.Errorf("%s was not successfully inserted into %s", testRepoName, hh.RepositoryFile())
} }
if err := addRepository(testName, ts.URL(), "", "", hh, "", "", "", false); err != nil { if err := addRepository(testRepoName, ts.URL(), "", "", hh, "", "", "", false); err != nil {
t.Errorf("Repository was not updated: %s", err) t.Errorf("Repository was not updated: %s", err)
} }
if err := addRepository(testName, ts.URL(), "", "", hh, "", "", "", false); err != nil { if err := addRepository(testRepoName, ts.URL(), "", "", hh, "", "", "", false); err != nil {
t.Errorf("Duplicate repository name was added") t.Errorf("Duplicate repository name was added")
} }
} }

@ -40,34 +40,35 @@ func TestRepoRemove(t *testing.T) {
os.RemoveAll(thome.String()) os.RemoveAll(thome.String())
cleanup() cleanup()
}() }()
if err := ensureTestHome(hh, t); err != nil { if err := ensureTestHome(t, hh); err != nil {
t.Fatal(err) t.Fatal(err)
} }
settings.Home = thome settings.Home = thome
b := bytes.NewBuffer(nil) const testRepoName = "test-name"
if err := removeRepoLine(b, testName, hh); err == nil { b := bytes.NewBuffer(nil)
t.Errorf("Expected error removing %s, but did not get one.", testName) if err := removeRepoLine(b, testRepoName, hh); err == nil {
t.Errorf("Expected error removing %s, but did not get one.", testRepoName)
} }
if err := addRepository(testName, ts.URL(), "", "", hh, "", "", "", true); err != nil { if err := addRepository(testRepoName, ts.URL(), "", "", hh, "", "", "", true); err != nil {
t.Error(err) t.Error(err)
} }
mf, _ := os.Create(hh.CacheIndex(testName)) mf, _ := os.Create(hh.CacheIndex(testRepoName))
mf.Close() mf.Close()
b.Reset() b.Reset()
if err := removeRepoLine(b, testName, hh); err != nil { if err := removeRepoLine(b, testRepoName, hh); err != nil {
t.Errorf("Error removing %s from repositories", testName) t.Errorf("Error removing %s from repositories", testRepoName)
} }
if !strings.Contains(b.String(), "has been removed") { if !strings.Contains(b.String(), "has been removed") {
t.Errorf("Unexpected output: %s", b.String()) t.Errorf("Unexpected output: %s", b.String())
} }
if _, err := os.Stat(hh.CacheIndex(testName)); err == nil { if _, err := os.Stat(hh.CacheIndex(testRepoName)); err == nil {
t.Errorf("Error cache file was not removed for repository %s", testName) t.Errorf("Error cache file was not removed for repository %s", testRepoName)
} }
f, err := repo.LoadRepositoriesFile(hh.RepositoryFile()) f, err := repo.LoadRepositoriesFile(hh.RepositoryFile())
@ -75,7 +76,7 @@ func TestRepoRemove(t *testing.T) {
t.Error(err) t.Error(err)
} }
if f.Has(testName) { if f.Has(testRepoName) {
t.Errorf("%s was not successfully removed from repositories list", testName) t.Errorf("%s was not successfully removed from repositories list", testRepoName)
} }
} }

@ -78,7 +78,7 @@ func TestUpdateCharts(t *testing.T) {
os.RemoveAll(thome.String()) os.RemoveAll(thome.String())
cleanup() cleanup()
}() }()
if err := ensureTestHome(hh, t); err != nil { if err := ensureTestHome(t, hh); err != nil {
t.Fatal(err) t.Fatal(err)
} }

@ -21,28 +21,23 @@ import (
) )
func TestRollbackCmd(t *testing.T) { func TestRollbackCmd(t *testing.T) {
tests := []releaseCase{{
tests := []releaseCase{ name: "rollback a release",
{ cmd: "rollback funny-honey 1",
name: "rollback a release", golden: "output/rollback.txt",
cmd: "rollback funny-honey 1", }, {
matches: "Rollback was a success! Happy Helming!", name: "rollback a release with timeout",
}, cmd: "rollback funny-honey 1 --timeout 120",
{ golden: "output/rollback-timeout.txt",
name: "rollback a release with timeout", }, {
cmd: "rollback funny-honey 1 --timeout 120", name: "rollback a release with wait",
matches: "Rollback was a success! Happy Helming!", cmd: "rollback funny-honey 1 --wait",
}, golden: "output/rollback-wait.txt",
{ }, {
name: "rollback a release with wait", name: "rollback a release without revision",
cmd: "rollback funny-honey 1 --wait", cmd: "rollback funny-honey",
matches: "Rollback was a success! Happy Helming!", golden: "output/rollback-no-args.txt",
}, wantError: true,
{ }}
name: "rollback a release without revision",
cmd: "rollback funny-honey",
wantError: true,
},
}
testReleaseCmd(t, tests) testReleaseCmd(t, tests)
} }

@ -21,58 +21,47 @@ import (
) )
func TestSearchCmd(t *testing.T) { func TestSearchCmd(t *testing.T) {
tests := []releaseCase{ tests := []releaseCase{{
{ name: "search for 'maria', expect one match",
name: "search for 'maria', expect one match", cmd: "search maria",
cmd: "search maria", golden: "output/search-single.txt",
matches: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/mariadb\t0.3.0 \t \tChart for MariaDB", }, {
}, name: "search for 'alpine', expect two matches",
{ cmd: "search alpine",
name: "search for 'alpine', expect two matches", golden: "output/search-multiple.txt",
cmd: "search alpine", }, {
matches: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod", name: "search for 'alpine' with versions, expect three matches",
}, cmd: "search alpine --versions",
{ golden: "output/search-multiple-versions.txt",
name: "search for 'alpine' with versions, expect three matches", }, {
cmd: "search alpine --versions", name: "search for 'alpine' with version constraint, expect one match with version 0.1.0",
matches: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod\ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", cmd: "search alpine --version '>= 0.1, < 0.2'",
}, golden: "output/search-constraint.txt",
{ }, {
name: "search for 'alpine' with version constraint, expect one match with version 0.1.0", name: "search for 'alpine' with version constraint, expect one match with version 0.1.0",
cmd: "search alpine --version '>= 0.1, < 0.2'", cmd: "search alpine --versions --version '>= 0.1, < 0.2'",
matches: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", golden: "output/search-versions-constraint.txt",
}, }, {
{ name: "search for 'alpine' with version constraint, expect one match with version 0.2.0",
name: "search for 'alpine' with version constraint, expect one match with version 0.1.0", cmd: "search alpine --version '>= 0.1'",
cmd: "search alpine --versions --version '>= 0.1, < 0.2'", golden: "output/search-constraint-single.txt",
matches: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", }, {
}, name: "search for 'alpine' with version constraint and --versions, expect two matches",
{ cmd: "search alpine --versions --version '>= 0.1'",
name: "search for 'alpine' with version constraint, expect one match with version 0.2.0", golden: "output/search-multiple-versions-constraints.txt",
cmd: "search alpine --version '>= 0.1'", }, {
matches: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod", name: "search for 'syzygy', expect no matches",
}, cmd: "search syzygy",
{ golden: "output/search-not-found.txt",
name: "search for 'alpine' with version constraint and --versions, expect two matches", }, {
cmd: "search alpine --versions --version '>= 0.1'", name: "search for 'alp[a-z]+', expect two matches",
matches: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod\ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod", cmd: "search alp[a-z]+ --regexp",
}, golden: "output/search-regex.txt",
{ }, {
name: "search for 'syzygy', expect no matches", name: "search for 'alp[', expect failure to compile regexp",
cmd: "search syzygy", cmd: "search alp[ --regexp",
matches: "No results found", wantError: true,
}, }}
{
name: "search for 'alp[a-z]+', expect two matches",
cmd: "search alp[a-z]+ --regexp",
matches: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod",
},
{
name: "search for 'alp[', expect failure to compile regexp",
cmd: "search alp[ --regexp",
wantError: true,
},
}
cleanup := resetEnv() cleanup := resetEnv()
defer cleanup() defer cleanup()

@ -17,7 +17,6 @@ limitations under the License.
package main package main
import ( import (
"fmt"
"testing" "testing"
"time" "time"
@ -25,107 +24,70 @@ import (
) )
func TestStatusCmd(t *testing.T) { func TestStatusCmd(t *testing.T) {
tests := []releaseCase{ releasesMockWithStatus := func(info *release.Info) []*release.Release {
{ info.LastDeployed = time.Unix(1452902400, 0)
name: "get status of a deployed release", return []*release.Release{{
cmd: "status flummoxed-chickadee", Name: "flummoxed-chickadee",
matches: outputWithStatus("deployed"), Info: info,
rels: []*release.Release{ }}
releaseMockWithStatus(&release.Info{
Status: release.StatusDeployed,
}),
},
},
{
name: "get status of a deployed release with notes",
cmd: "status flummoxed-chickadee",
matches: outputWithStatus("deployed\n\nNOTES:\nrelease notes\n"),
rels: []*release.Release{
releaseMockWithStatus(&release.Info{
Status: release.StatusDeployed,
Notes: "release notes",
}),
},
},
{
name: "get status of a deployed release with notes in json",
cmd: "status flummoxed-chickadee -o json",
matches: `{"name":"flummoxed-chickadee","info":{"first_deployed":(.*),"last_deployed":(.*),"deleted":(.*),"status":"deployed","notes":"release notes"}}`,
rels: []*release.Release{
releaseMockWithStatus(&release.Info{
Status: release.StatusDeployed,
Notes: "release notes",
}),
},
},
{
name: "get status of a deployed release with resources",
cmd: "status flummoxed-chickadee",
matches: outputWithStatus("deployed\n\nRESOURCES:\nresource A\nresource B\n\n"),
rels: []*release.Release{
releaseMockWithStatus(&release.Info{
Status: release.StatusDeployed,
Resources: "resource A\nresource B\n",
}),
},
},
{
name: "get status of a deployed release with resources in YAML",
cmd: "status flummoxed-chickadee -o yaml",
matches: `info:\n deleted: .*\n first_deployed: .*\n last_deployed: .*\n resources: |\n resource A\n resource B\n status: deployed\nname: flummoxed-chickadee\n`,
rels: []*release.Release{
releaseMockWithStatus(&release.Info{
Status: release.StatusDeployed,
Resources: "resource A\nresource B\n",
}),
},
},
{
name: "get status of a deployed release with test suite",
cmd: "status flummoxed-chickadee",
matches: outputWithStatus(
"deployed\n\nTEST SUITE:\nLast Started: (.*)\nLast Completed: (.*)\n\n" +
"TEST \tSTATUS (.*)\tINFO (.*)\tSTARTED (.*)\tCOMPLETED (.*)\n" +
"test run 1\tsuccess (.*)\textra info\t(.*)\t(.*)\n" +
"test run 2\tfailure (.*)\t (.*)\t(.*)\t(.*)\n"),
rels: []*release.Release{
releaseMockWithStatus(&release.Info{
Status: release.StatusDeployed,
LastTestSuiteRun: &release.TestSuite{
StartedAt: time.Now(),
CompletedAt: time.Now(),
Results: []*release.TestRun{
{
Name: "test run 1",
Status: release.TestRunSuccess,
Info: "extra info",
StartedAt: time.Now(),
CompletedAt: time.Now(),
},
{
Name: "test run 2",
Status: release.TestRunFailure,
StartedAt: time.Now(),
CompletedAt: time.Now(),
},
},
},
}),
},
},
} }
testReleaseCmd(t, tests)
}
func outputWithStatus(status string) string {
return fmt.Sprintf(`LAST DEPLOYED:(.*)\nNAMESPACE: \nSTATUS: %s`, status)
}
func releaseMockWithStatus(info *release.Info) *release.Release { tests := []releaseCase{{
info.FirstDeployed = time.Now() name: "get status of a deployed release",
info.LastDeployed = time.Now() cmd: "status flummoxed-chickadee",
return &release.Release{ golden: "output/status.txt",
Name: "flummoxed-chickadee", rels: releasesMockWithStatus(&release.Info{
Info: info, Status: release.StatusDeployed,
} }),
}, {
name: "get status of a deployed release with notes",
cmd: "status flummoxed-chickadee",
golden: "output/status-with-notes.txt",
rels: releasesMockWithStatus(&release.Info{
Status: release.StatusDeployed,
Notes: "release notes",
}),
}, {
name: "get status of a deployed release with notes in json",
cmd: "status flummoxed-chickadee -o json",
golden: "output/status.json",
rels: releasesMockWithStatus(&release.Info{
Status: release.StatusDeployed,
Notes: "release notes",
}),
}, {
name: "get status of a deployed release with resources",
cmd: "status flummoxed-chickadee",
golden: "output/status-with-resource.txt",
rels: releasesMockWithStatus(&release.Info{
Status: release.StatusDeployed,
Resources: "resource A\nresource B\n",
}),
}, {
name: "get status of a deployed release with resources in YAML",
cmd: "status flummoxed-chickadee -o yaml",
golden: "output/status.yaml",
rels: releasesMockWithStatus(&release.Info{
Status: release.StatusDeployed,
Resources: "resource A\nresource B\n",
}),
}, {
name: "get status of a deployed release with test suite",
cmd: "status flummoxed-chickadee",
golden: "output/status-with-test-suite.txt",
rels: releasesMockWithStatus(&release.Info{
Status: release.StatusDeployed,
LastTestSuiteRun: &release.TestSuite{
Results: []*release.TestRun{{
Name: "test run 1",
Status: release.TestRunSuccess,
Info: "extra info",
}, {
Name: "test run 2",
Status: release.TestRunFailure,
}},
},
}),
}}
testReleaseCmd(t, tests)
} }

@ -0,0 +1 @@
Error: command 'delete' requires a release name

@ -0,0 +1 @@
release "aeneas" deleted

@ -0,0 +1 @@
release "aeneas" deleted

@ -0,0 +1 @@
release "aeneas" deleted

@ -0,0 +1 @@
release "aeneas" deleted

@ -0,0 +1,4 @@
NAME VERSION REPOSITORY STATUS
reqsubchart 0.1.0 https://example.com/charts missing
reqsubchart2 0.2.0 https://example.com/charts missing

@ -0,0 +1 @@
Error: stat /no/such/chart: no such file or directory

@ -0,0 +1 @@
WARNING: no requirements at testdata/testcharts/alpine/charts

@ -0,0 +1,5 @@
NAME VERSION REPOSITORY STATUS
reqsubchart 0.1.0 https://example.com/charts unpacked
reqsubchart2 0.2.0 https://example.com/charts unpacked
reqsubchart3 >=0.1.0 https://example.com/charts ok

@ -0,0 +1 @@
Error: release name is required

@ -0,0 +1,7 @@
---
# pre-install-hook
apiVersion: v1
kind: Job
metadata:
annotations:
"helm.sh/hook": pre-install

@ -0,0 +1 @@
Error: release name is required

@ -0,0 +1,5 @@
apiVersion: v1
kind: Secret
metadata:
name: fixture

@ -0,0 +1 @@
Error: release name is required

@ -0,0 +1,23 @@
REVISION: 1
RELEASED: Fri Sep 2 22:04:05 1977
CHART: foo-0.1.0-beta.1
USER-SUPPLIED VALUES:
name: "value"
COMPUTED VALUES:
name: value
HOOKS:
---
# pre-install-hook
apiVersion: v1
kind: Job
metadata:
annotations:
"helm.sh/hook": pre-install
MANIFEST:
apiVersion: v1
kind: Secret
metadata:
name: fixture

@ -0,0 +1 @@
Error: release name is required

@ -0,0 +1 @@
name: "value"

@ -0,0 +1,3 @@
REVISION UPDATED STATUS CHART DESCRIPTION
3 1977-09-02 22:04:05 +0000 UTC superseded foo-0.1.0-beta.1 Release mock
4 1977-09-02 22:04:05 +0000 UTC deployed foo-0.1.0-beta.1 Release mock

@ -0,0 +1 @@
[{"revision":3,"updated":"1977-09-02 22:04:05 +0000 UTC","status":"superseded","chart":"foo-0.1.0-beta.1","description":"Release mock"},{"revision":4,"updated":"1977-09-02 22:04:05 +0000 UTC","status":"deployed","chart":"foo-0.1.0-beta.1","description":"Release mock"}]

@ -0,0 +1,5 @@
REVISION UPDATED STATUS CHART DESCRIPTION
1 1977-09-02 22:04:05 +0000 UTC superseded foo-0.1.0-beta.1 Release mock
2 1977-09-02 22:04:05 +0000 UTC superseded foo-0.1.0-beta.1 Release mock
3 1977-09-02 22:04:05 +0000 UTC superseded foo-0.1.0-beta.1 Release mock
4 1977-09-02 22:04:05 +0000 UTC deployed foo-0.1.0-beta.1 Release mock

@ -0,0 +1,11 @@
- chart: foo-0.1.0-beta.1
description: Release mock
revision: 3
status: superseded
updated: 1977-09-02 22:04:05 +0000 UTC
- chart: foo-0.1.0-beta.1
description: Release mock
revision: 4
status: deployed
updated: 1977-09-02 22:04:05 +0000 UTC

@ -0,0 +1,5 @@
NAME: aeneas
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,5 @@
NAME: FOOBAR
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1 @@
Error: This command needs 1 argument: chart name

@ -0,0 +1,5 @@
NAME: aeneas
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,5 @@
NAME: virgil
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,5 @@
NAME: virgil
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,5 @@
NAME: foobar
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,5 @@
NAME: virgil
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,5 @@
NAME: virgil
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,5 @@
NAME: apollo
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,5 @@
NAME: aeneas
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,2 @@
thomas-guide
atlas-guide

@ -0,0 +1,2 @@
thomas-guide
atlas-guide

@ -0,0 +1,2 @@
thomas-guide
atlas-guide

@ -0,0 +1,2 @@
thomas-guide
atlas-guide

@ -0,0 +1,3 @@
NAME REVISION UPDATED STATUS CHART NAMESPACE
thomas-guide 1 1977-09-02 22:04:05 +0000 UTC deployed foo-0.1.0-beta.1 default
thomas-guide 1 1977-09-02 22:04:05 +0000 UTC failed foo-0.1.0-beta.1 default

@ -0,0 +1,4 @@
thomas-guide
wild-idea
crazy-maps
atlas-guide

@ -0,0 +1,2 @@
NAME REVISION UPDATED STATUS CHART NAMESPACE
thomas-guide 1 1977-09-02 22:04:05 +0000 UTC deployed foo-0.1.0-beta.1 default

@ -0,0 +1,2 @@
NAME REVISION UPDATED STATUS CHART NAMESPACE
atlas 1 1977-09-02 22:04:05 +0000 UTC deployed foo-0.1.0-beta.1 default

@ -0,0 +1 @@
"test-name" has been added to your repositories

@ -0,0 +1 @@
Error: This command needs 2 arguments: release name, revision number

@ -0,0 +1 @@
Rollback was a success! Happy Helming!

@ -0,0 +1 @@
Rollback was a success! Happy Helming!

@ -0,0 +1 @@
Rollback was a success! Happy Helming!

@ -0,0 +1,2 @@
NAME CHART VERSION APP VERSION DESCRIPTION
testing/alpine 0.2.0 2.3.4 Deploy a basic Alpine Linux pod

@ -0,0 +1,2 @@
NAME CHART VERSION APP VERSION DESCRIPTION
testing/alpine 0.1.0 1.2.3 Deploy a basic Alpine Linux pod

@ -0,0 +1,3 @@
NAME CHART VERSION APP VERSION DESCRIPTION
testing/alpine 0.2.0 2.3.4 Deploy a basic Alpine Linux pod
testing/alpine 0.1.0 1.2.3 Deploy a basic Alpine Linux pod

@ -0,0 +1,3 @@
NAME CHART VERSION APP VERSION DESCRIPTION
testing/alpine 0.2.0 2.3.4 Deploy a basic Alpine Linux pod
testing/alpine 0.1.0 1.2.3 Deploy a basic Alpine Linux pod

@ -0,0 +1,2 @@
NAME CHART VERSION APP VERSION DESCRIPTION
testing/alpine 0.2.0 2.3.4 Deploy a basic Alpine Linux pod

@ -0,0 +1,2 @@
NAME CHART VERSION APP VERSION DESCRIPTION
testing/alpine 0.2.0 2.3.4 Deploy a basic Alpine Linux pod

@ -0,0 +1,2 @@
NAME CHART VERSION APP VERSION DESCRIPTION
testing/mariadb 0.3.0 Chart for MariaDB

@ -0,0 +1,2 @@
NAME CHART VERSION APP VERSION DESCRIPTION
testing/alpine 0.1.0 1.2.3 Deploy a basic Alpine Linux pod

@ -0,0 +1,6 @@
LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC
NAMESPACE:
STATUS: deployed
NOTES:
release notes

@ -0,0 +1,8 @@
LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC
NAMESPACE:
STATUS: deployed
RESOURCES:
resource A
resource B

@ -0,0 +1,11 @@
LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC
NAMESPACE:
STATUS: deployed
TEST SUITE:
Last Started: 0001-01-01 00:00:00 +0000 UTC
Last Completed: 0001-01-01 00:00:00 +0000 UTC
TEST STATUS INFO STARTED COMPLETED
test run 1 success extra info 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC
test run 2 failure 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC

@ -0,0 +1 @@
{"name":"flummoxed-chickadee","info":{"first_deployed":"0001-01-01T00:00:00Z","last_deployed":"2016-01-16T00:00:00Z","deleted":"0001-01-01T00:00:00Z","status":"deployed","notes":"release notes"}}

@ -0,0 +1,4 @@
LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC
NAMESPACE:
STATUS: deployed

@ -0,0 +1,9 @@
info:
deleted: 0001-01-01T00:00:00Z
first_deployed: 0001-01-01T00:00:00Z
last_deployed: 2016-01-16T00:00:00Z
resources: |
resource A
resource B
status: deployed
name: flummoxed-chickadee

@ -0,0 +1,2 @@
ERROR: yellow lights everywhere
Error: 1 test(s) failed

@ -0,0 +1,2 @@
FAILURE: red lights everywhere
Error: 1 test(s) failed

@ -0,0 +1 @@
RUNNING: things are happpeningggg

@ -0,0 +1 @@
UNKNOWN: yellow lights everywhere

@ -0,0 +1 @@
PASSED: green lights everywhere

@ -0,0 +1 @@
Error: cannot load requirements: error converting YAML to JSON: yaml: line 2: did not find expected '-' indicator

@ -0,0 +1,49 @@
REVISION: 1
RELEASED: Fri Sep 2 22:04:05 1977
CHART: testUpgradeChart-0.1.0
USER-SUPPLIED VALUES:
name: "value"
COMPUTED VALUES:
affinity: {}
fullnameOverride: ""
image:
pullPolicy: IfNotPresent
repository: nginx
tag: stable
ingress:
annotations: {}
enabled: false
hosts:
- chart-example.local
path: /
tls: []
name: value
nameOverride: ""
nodeSelector: {}
replicaCount: 1
resources: {}
service:
port: 80
type: ClusterIP
tolerations: []
HOOKS:
---
# pre-install-hook
apiVersion: v1
kind: Job
metadata:
annotations:
"helm.sh/hook": pre-install
MANIFEST:
apiVersion: v1
kind: Secret
metadata:
name: fixture
Release "crazy-bunny" has been upgraded. Happy Helming!
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,49 @@
REVISION: 1
RELEASED: Fri Sep 2 22:04:05 1977
CHART: testUpgradeChart-0.1.0
USER-SUPPLIED VALUES:
name: "value"
COMPUTED VALUES:
affinity: {}
fullnameOverride: ""
image:
pullPolicy: IfNotPresent
repository: nginx
tag: stable
ingress:
annotations: {}
enabled: false
hosts:
- chart-example.local
path: /
tls: []
name: value
nameOverride: ""
nodeSelector: {}
replicaCount: 1
resources: {}
service:
port: 80
type: ClusterIP
tolerations: []
HOOKS:
---
# pre-install-hook
apiVersion: v1
kind: Job
metadata:
annotations:
"helm.sh/hook": pre-install
MANIFEST:
apiVersion: v1
kind: Secret
metadata:
name: fixture
Release "zany-bunny" has been upgraded. Happy Helming!
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1 @@
Error: This command needs 2 arguments: release name, chart path

@ -0,0 +1,49 @@
REVISION: 4
RELEASED: Fri Sep 2 22:04:05 1977
CHART: testUpgradeChart-0.1.0
USER-SUPPLIED VALUES:
name: "value"
COMPUTED VALUES:
affinity: {}
fullnameOverride: ""
image:
pullPolicy: IfNotPresent
repository: nginx
tag: stable
ingress:
annotations: {}
enabled: false
hosts:
- chart-example.local
path: /
tls: []
name: value
nameOverride: ""
nodeSelector: {}
replicaCount: 1
resources: {}
service:
port: 80
type: ClusterIP
tolerations: []
HOOKS:
---
# pre-install-hook
apiVersion: v1
kind: Job
metadata:
annotations:
"helm.sh/hook": pre-install
MANIFEST:
apiVersion: v1
kind: Secret
metadata:
name: fixture
Release "funny-bunny" has been upgraded. Happy Helming!
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,49 @@
REVISION: 5
RELEASED: Fri Sep 2 22:04:05 1977
CHART: testUpgradeChart-0.1.0
USER-SUPPLIED VALUES:
name: "value"
COMPUTED VALUES:
affinity: {}
fullnameOverride: ""
image:
pullPolicy: IfNotPresent
repository: nginx
tag: stable
ingress:
annotations: {}
enabled: false
hosts:
- chart-example.local
path: /
tls: []
name: value
nameOverride: ""
nodeSelector: {}
replicaCount: 1
resources: {}
service:
port: 80
type: ClusterIP
tolerations: []
HOOKS:
---
# pre-install-hook
apiVersion: v1
kind: Job
metadata:
annotations:
"helm.sh/hook": pre-install
MANIFEST:
apiVersion: v1
kind: Secret
metadata:
name: fixture
Release "funny-bunny" has been upgraded. Happy Helming!
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save