mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
ref(tests): use golden files for testing command output
This commit is contained in:
parent
259fd3622c
commit
75c4df0b56
126 changed files with 1301 additions and 852 deletions
8
Gopkg.lock
generated
8
Gopkg.lock
generated
|
|
@ -384,6 +384,12 @@
|
|||
revision = "5f041e8faa004a95c88a202771f4cc3e991971e6"
|
||||
version = "v2.0.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
||||
version = "v0.8.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
|
|
@ -1071,6 +1077,6 @@
|
|||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "82526354be9627a0e3796098ee9bed433a3e7958495f65e371ecc27d8c71c111"
|
||||
inputs-digest = "4a0464d8de132c8a733f50549ad69e663b992e12537b58626302dc5dd14cd3f0"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -46,8 +47,7 @@ func TestCreateCmd(t *testing.T) {
|
|||
defer os.Chdir(pwd)
|
||||
|
||||
// Run a create
|
||||
cmd := newCreateCmd(ioutil.Discard)
|
||||
if err := cmd.RunE(cmd, []string{cname}); err != nil {
|
||||
if _, err := executeCommand(nil, "create "+cname); err != nil {
|
||||
t.Errorf("Failed to run create: %s", err)
|
||||
return
|
||||
}
|
||||
|
|
@ -117,9 +117,7 @@ func TestCreateStarterCmd(t *testing.T) {
|
|||
defer os.Chdir(pwd)
|
||||
|
||||
// Run a create
|
||||
cmd := newCreateCmd(ioutil.Discard)
|
||||
cmd.ParseFlags([]string{"--starter", "starterchart"})
|
||||
if err := cmd.RunE(cmd, []string{cname}); err != nil {
|
||||
if _, err := executeCommand(nil, fmt.Sprintf("--home=%s create --starter=starterchart %s", thome, cname)); err != nil {
|
||||
t.Errorf("Failed to run create: %s", err)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,41 +25,37 @@ import (
|
|||
|
||||
func TestDelete(t *testing.T) {
|
||||
|
||||
resp := helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})
|
||||
rels := []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}
|
||||
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "basic delete",
|
||||
cmd: "delete aeneas",
|
||||
matches: `release "aeneas" deleted`,
|
||||
resp: resp,
|
||||
rels: rels,
|
||||
name: "basic delete",
|
||||
cmd: "delete aeneas",
|
||||
golden: "output/delete.txt",
|
||||
rels: rels,
|
||||
},
|
||||
{
|
||||
name: "delete with timeout",
|
||||
cmd: "delete aeneas --timeout 120",
|
||||
matches: `release "aeneas" deleted`,
|
||||
resp: resp,
|
||||
rels: rels,
|
||||
name: "delete with timeout",
|
||||
cmd: "delete aeneas --timeout 120",
|
||||
golden: "output/delete-timeout.txt",
|
||||
rels: rels,
|
||||
},
|
||||
{
|
||||
name: "delete without hooks",
|
||||
cmd: "delete aeneas --no-hooks",
|
||||
matches: `release "aeneas" deleted`,
|
||||
resp: resp,
|
||||
rels: rels,
|
||||
name: "delete without hooks",
|
||||
cmd: "delete aeneas --no-hooks",
|
||||
golden: "output/delete-no-hooks.txt",
|
||||
rels: rels,
|
||||
},
|
||||
{
|
||||
name: "purge",
|
||||
cmd: "delete aeneas --purge",
|
||||
matches: `release "aeneas" deleted`,
|
||||
resp: resp,
|
||||
rels: rels,
|
||||
name: "purge",
|
||||
cmd: "delete aeneas --purge",
|
||||
golden: "output/delete-purge.txt",
|
||||
rels: rels,
|
||||
},
|
||||
{
|
||||
name: "delete without release",
|
||||
cmd: "delete",
|
||||
golden: "output/delete-no-args.txt",
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,11 +121,7 @@ func newDependencyListCmd(out io.Writer) *cobra.Command {
|
|||
cp = args[0]
|
||||
}
|
||||
|
||||
var err error
|
||||
dlc.chartpath, err = filepath.Abs(cp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dlc.chartpath = filepath.Clean(cp)
|
||||
return dlc.run()
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,13 +16,11 @@ limitations under the License.
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"k8s.io/helm/pkg/helm/helmpath"
|
||||
"k8s.io/helm/pkg/provenance"
|
||||
"k8s.io/helm/pkg/repo"
|
||||
"k8s.io/helm/pkg/repo/repotest"
|
||||
|
|
@ -53,32 +51,28 @@ func TestDependencyBuildCmd(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
out := bytes.NewBuffer(nil)
|
||||
dbc := &dependencyBuildCmd{out: out}
|
||||
dbc.helmhome = helmpath.Home(hh)
|
||||
dbc.chartpath = filepath.Join(hh.String(), chartname)
|
||||
cmd := fmt.Sprintf("--home=%s dependency build %s", hh, hh.Path(chartname))
|
||||
out, err := executeCommand(nil, cmd)
|
||||
|
||||
// In the first pass, we basically want the same results as an update.
|
||||
if err := dbc.run(); err != nil {
|
||||
output := out.String()
|
||||
t.Logf("Output: %s", output)
|
||||
if err != nil {
|
||||
t.Logf("Output: %s", out)
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
output := out.String()
|
||||
if !strings.Contains(output, `update from the "test" chart repository`) {
|
||||
t.Errorf("Repo did not get updated\n%s", output)
|
||||
if !strings.Contains(out, `update from the "test" chart repository`) {
|
||||
t.Errorf("Repo did not get updated\n%s", out)
|
||||
}
|
||||
|
||||
// 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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// In the second pass, we want to remove the chart's request dependency,
|
||||
// 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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -86,14 +80,14 @@ func TestDependencyBuildCmd(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := dbc.run(); err != nil {
|
||||
output := out.String()
|
||||
t.Logf("Output: %s", output)
|
||||
out, err = executeCommand(nil, cmd)
|
||||
if err != nil {
|
||||
t.Logf("Output: %s", out)
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// 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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -104,7 +98,7 @@ func TestDependencyBuildCmd(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
i, err := repo.LoadIndexFile(dbc.helmhome.CacheIndex("test"))
|
||||
i, err := repo.LoadIndexFile(hh.CacheIndex("test"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -116,5 +110,4 @@ func TestDependencyBuildCmd(t *testing.T) {
|
|||
if v := reqver.Version; v != "0.1.0" {
|
||||
t.Errorf("mismatched versions. Expected %q, got %q", "0.1.0", v)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,31 +20,23 @@ import (
|
|||
)
|
||||
|
||||
func TestDependencyListCmd(t *testing.T) {
|
||||
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "No such chart",
|
||||
cmd: "dependency list /no/such/chart",
|
||||
wantError: true,
|
||||
},
|
||||
{
|
||||
name: "No requirements.yaml",
|
||||
cmd: "dependency list testdata/testcharts/alpine",
|
||||
matches: "WARNING: no requirements at ",
|
||||
},
|
||||
{
|
||||
name: "Requirements in chart dir",
|
||||
cmd: "dependency list testdata/testcharts/reqtest",
|
||||
matches: "NAME \tVERSION\tREPOSITORY \tSTATUS \n" +
|
||||
"reqsubchart \t0.1.0 \thttps://example.com/charts\tunpacked\n" +
|
||||
"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",
|
||||
},
|
||||
}
|
||||
tests := []releaseCase{{
|
||||
name: "No such chart",
|
||||
cmd: "dependency list /no/such/chart",
|
||||
golden: "output/dependency-list-no-chart.txt",
|
||||
wantError: true,
|
||||
}, {
|
||||
name: "No requirements.yaml",
|
||||
cmd: "dependency list testdata/testcharts/alpine",
|
||||
golden: "output/dependency-list-no-requirements.txt",
|
||||
}, {
|
||||
name: "Requirements in chart dir",
|
||||
cmd: "dependency list testdata/testcharts/reqtest",
|
||||
golden: "output/dependency-list.txt",
|
||||
}, {
|
||||
name: "Requirements in chart archive",
|
||||
cmd: "dependency list testdata/testcharts/reqtest-0.1.0.tgz",
|
||||
golden: "output/dependency-list-archive.txt",
|
||||
}}
|
||||
testReleaseCmd(t, tests)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"path/filepath"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"k8s.io/helm/pkg/downloader"
|
||||
"k8s.io/helm/pkg/getter"
|
||||
"k8s.io/helm/pkg/helm/helmpath"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -60,25 +61,19 @@ func TestDependencyUpdateCmd(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
out := bytes.NewBuffer(nil)
|
||||
duc := &dependencyUpdateCmd{out: out}
|
||||
duc.helmhome = helmpath.Home(hh)
|
||||
duc.chartpath = filepath.Join(hh.String(), chartname)
|
||||
|
||||
if err := duc.run(); err != nil {
|
||||
output := out.String()
|
||||
t.Logf("Output: %s", output)
|
||||
out, err := executeCommand(nil, fmt.Sprintf("--home=%s dependency update %s", hh, hh.Path(chartname)))
|
||||
if err != nil {
|
||||
t.Logf("Output: %s", out)
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
output := out.String()
|
||||
// This is written directly to stdout, so we have to capture as is.
|
||||
if !strings.Contains(output, `update from the "test" chart repository`) {
|
||||
t.Errorf("Repo did not get updated\n%s", output)
|
||||
if !strings.Contains(out, `update from the "test" chart repository`) {
|
||||
t.Errorf("Repo did not get updated\n%s", out)
|
||||
}
|
||||
|
||||
// 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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -88,7 +83,7 @@ func TestDependencyUpdateCmd(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
i, err := repo.LoadIndexFile(duc.helmhome.CacheIndex("test"))
|
||||
i, err := repo.LoadIndexFile(hh.CacheIndex("test"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
@ -106,23 +101,24 @@ func TestDependencyUpdateCmd(t *testing.T) {
|
|||
{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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := duc.run(); err != nil {
|
||||
output := out.String()
|
||||
t.Logf("Output: %s", output)
|
||||
|
||||
out, err = executeCommand(nil, fmt.Sprintf("--home=%s dependency update %s", hh, hh.Path(chartname)))
|
||||
if err != nil {
|
||||
t.Logf("Output: %s", out)
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// In this second run, we should see compressedchart-0.3.0.tgz, and not
|
||||
// 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 {
|
||||
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 {
|
||||
t.Fatalf("Unexpected %q", dontExpect)
|
||||
}
|
||||
|
|
@ -155,20 +151,14 @@ func TestDependencyUpdateCmd_SkipRefresh(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
out := bytes.NewBuffer(nil)
|
||||
duc := &dependencyUpdateCmd{out: out}
|
||||
duc.helmhome = helmpath.Home(hh)
|
||||
duc.chartpath = filepath.Join(hh.String(), chartname)
|
||||
duc.skipRefresh = true
|
||||
|
||||
if err := duc.run(); err == nil {
|
||||
out, err := executeCommand(nil, fmt.Sprintf("--home=%s dependency update --skip-refresh %s", hh, hh.Path(chartname)))
|
||||
if err == nil {
|
||||
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.
|
||||
if strings.Contains(output, `update from the "test" chart repository`) {
|
||||
t.Errorf("Repo was unexpectedly updated\n%s", output)
|
||||
if strings.Contains(out, `update from the "test" chart repository`) {
|
||||
t.Errorf("Repo was unexpectedly updated\n%s", out)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +192,7 @@ func TestDependencyUpdateCmd_DontDeleteOldChartsOnError(t *testing.T) {
|
|||
out := bytes.NewBuffer(nil)
|
||||
duc := &dependencyUpdateCmd{out: out}
|
||||
duc.helmhome = helmpath.Home(hh)
|
||||
duc.chartpath = filepath.Join(hh.String(), chartname)
|
||||
duc.chartpath = hh.Path(chartname)
|
||||
|
||||
if err := duc.run(); err != nil {
|
||||
output := out.String()
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ limitations under the License.
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"k8s.io/helm/pkg/repo/repotest"
|
||||
|
|
@ -45,9 +45,8 @@ func TestFetchCmd(t *testing.T) {
|
|||
// all flags will get "--home=TMDIR -d outdir" appended.
|
||||
tests := []struct {
|
||||
name string
|
||||
chart string
|
||||
flags []string
|
||||
fail bool
|
||||
args []string
|
||||
wantError bool
|
||||
failExpect string
|
||||
expectFile string
|
||||
expectDir bool
|
||||
|
|
@ -55,82 +54,72 @@ func TestFetchCmd(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
name: "Basic chart fetch",
|
||||
chart: "test/signtest",
|
||||
args: []string{"test/signtest"},
|
||||
expectFile: "./signtest-0.1.0.tgz",
|
||||
},
|
||||
{
|
||||
name: "Chart fetch with version",
|
||||
chart: "test/signtest",
|
||||
flags: []string{"--version", "0.1.0"},
|
||||
args: []string{"test/signtest --version=0.1.0"},
|
||||
expectFile: "./signtest-0.1.0.tgz",
|
||||
},
|
||||
{
|
||||
name: "Fail chart fetch with non-existent version",
|
||||
chart: "test/signtest",
|
||||
flags: []string{"--version", "99.1.0"},
|
||||
fail: true,
|
||||
args: []string{"test/signtest --version=99.1.0"},
|
||||
wantError: true,
|
||||
failExpect: "no such chart",
|
||||
},
|
||||
{
|
||||
name: "Fail fetching non-existent chart",
|
||||
chart: "test/nosuchthing",
|
||||
args: []string{"test/nosuchthing"},
|
||||
failExpect: "Failed to fetch",
|
||||
fail: true,
|
||||
wantError: true,
|
||||
},
|
||||
{
|
||||
name: "Fetch and verify",
|
||||
chart: "test/signtest",
|
||||
flags: []string{"--verify", "--keyring", "testdata/helm-test-key.pub"},
|
||||
args: []string{"test/signtest --verify --keyring testdata/helm-test-key.pub"},
|
||||
expectFile: "./signtest-0.1.0.tgz",
|
||||
expectVerify: true,
|
||||
},
|
||||
{
|
||||
name: "Fetch and fail verify",
|
||||
chart: "test/reqtest",
|
||||
flags: []string{"--verify", "--keyring", "testdata/helm-test-key.pub"},
|
||||
args: []string{"test/reqtest --verify --keyring testdata/helm-test-key.pub"},
|
||||
failExpect: "Failed to fetch provenance",
|
||||
fail: true,
|
||||
wantError: true,
|
||||
},
|
||||
{
|
||||
name: "Fetch and untar",
|
||||
chart: "test/signtest",
|
||||
flags: []string{"--untar", "--untardir", "signtest"},
|
||||
args: []string{"test/signtest --untar --untardir signtest"},
|
||||
expectFile: "./signtest",
|
||||
expectDir: true,
|
||||
},
|
||||
{
|
||||
name: "Fetch, verify, untar",
|
||||
chart: "test/signtest",
|
||||
flags: []string{"--verify", "--keyring", "testdata/helm-test-key.pub", "--untar", "--untardir", "signtest"},
|
||||
args: []string{"test/signtest --verify --keyring=testdata/helm-test-key.pub --untar --untardir signtest"},
|
||||
expectFile: "./signtest",
|
||||
expectDir: true,
|
||||
expectVerify: true,
|
||||
},
|
||||
{
|
||||
name: "Chart fetch using repo URL",
|
||||
chart: "signtest",
|
||||
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",
|
||||
chart: "someChart",
|
||||
flags: []string{"--repo", srv.URL()},
|
||||
args: []string{"someChart --repo", srv.URL()},
|
||||
failExpect: "Failed to fetch chart",
|
||||
fail: true,
|
||||
wantError: true,
|
||||
},
|
||||
{
|
||||
name: "Specific version chart fetch using repo URL",
|
||||
chart: "signtest",
|
||||
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",
|
||||
chart: "signtest",
|
||||
flags: []string{"--repo", srv.URL(), "--version", "0.2.0"},
|
||||
args: []string{"signtest --version=0.2.0 --repo", srv.URL()},
|
||||
failExpect: "Failed to fetch chart version",
|
||||
fail: true,
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -146,24 +135,23 @@ func TestFetchCmd(t *testing.T) {
|
|||
os.RemoveAll(outdir)
|
||||
os.Mkdir(outdir, 0755)
|
||||
|
||||
buf := bytes.NewBuffer(nil)
|
||||
cmd := newFetchCmd(buf)
|
||||
tt.flags = append(tt.flags, "-d", outdir)
|
||||
cmd.ParseFlags(tt.flags)
|
||||
if err := cmd.RunE(cmd, []string{tt.chart}); err != nil {
|
||||
if tt.fail {
|
||||
cmd := strings.Join(append(tt.args, "-d", outdir, "--home", hh.String()), " ")
|
||||
out, err := executeCommand(nil, "fetch "+cmd)
|
||||
if err != nil {
|
||||
if tt.wantError {
|
||||
continue
|
||||
}
|
||||
t.Errorf("%q reported error: %s", tt.name, err)
|
||||
continue
|
||||
}
|
||||
|
||||
if tt.expectVerify {
|
||||
pointerAddressPattern := "0[xX][A-Fa-f0-9]+"
|
||||
sha256Pattern := "[A-Fa-f0-9]{64}"
|
||||
verificationRegex := regexp.MustCompile(
|
||||
fmt.Sprintf("Verification: &{%s sha256:%s signtest-0.1.0.tgz}\n", pointerAddressPattern, sha256Pattern))
|
||||
if !verificationRegex.MatchString(buf.String()) {
|
||||
t.Errorf("%q: expected match for regex %s, got %s", tt.name, verificationRegex, buf.String())
|
||||
if !verificationRegex.MatchString(out) {
|
||||
t.Errorf("%q: expected match for regex %s, got %s", tt.name, verificationRegex, out)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,19 +24,16 @@ import (
|
|||
)
|
||||
|
||||
func TestGetHooks(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "get hooks with release",
|
||||
cmd: "get hooks aeneas",
|
||||
matches: helm.MockHookTemplate,
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}),
|
||||
rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})},
|
||||
},
|
||||
{
|
||||
name: "get hooks without args",
|
||||
cmd: "get hooks",
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
tests := []releaseCase{{
|
||||
name: "get hooks with release",
|
||||
cmd: "get hooks aeneas",
|
||||
golden: "output/get-hooks.txt",
|
||||
rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})},
|
||||
}, {
|
||||
name: "get hooks without args",
|
||||
cmd: "get hooks",
|
||||
golden: "output/get-hooks-no-args.txt",
|
||||
wantError: true,
|
||||
}}
|
||||
testReleaseCmd(t, tests)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,19 +24,16 @@ import (
|
|||
)
|
||||
|
||||
func TestGetManifest(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "get manifest with release",
|
||||
cmd: "get manifest juno",
|
||||
matches: helm.MockManifest,
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "juno"}),
|
||||
rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "juno"})},
|
||||
},
|
||||
{
|
||||
name: "get manifest without args",
|
||||
cmd: "get manifest",
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
tests := []releaseCase{{
|
||||
name: "get manifest with release",
|
||||
cmd: "get manifest juno",
|
||||
golden: "output/get-manifest.txt",
|
||||
rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "juno"})},
|
||||
}, {
|
||||
name: "get manifest without args",
|
||||
cmd: "get manifest",
|
||||
golden: "output/get-manifest-no-args.txt",
|
||||
wantError: true,
|
||||
}}
|
||||
testReleaseCmd(t, tests)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,19 +24,16 @@ import (
|
|||
)
|
||||
|
||||
func TestGetCmd(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "get with a release",
|
||||
cmd: "get thomas-guide",
|
||||
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"})},
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}),
|
||||
},
|
||||
{
|
||||
name: "get requires release name arg",
|
||||
cmd: "get",
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
tests := []releaseCase{{
|
||||
name: "get with a release",
|
||||
cmd: "get thomas-guide",
|
||||
golden: "output/get-release.txt",
|
||||
rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"})},
|
||||
}, {
|
||||
name: "get requires release name arg",
|
||||
cmd: "get",
|
||||
golden: "output/get-no-args.txt",
|
||||
wantError: true,
|
||||
}}
|
||||
testReleaseCmd(t, tests)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,19 +24,16 @@ import (
|
|||
)
|
||||
|
||||
func TestGetValuesCmd(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "get values with a release",
|
||||
cmd: "get values thomas-guide",
|
||||
matches: "name: \"value\"",
|
||||
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",
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
tests := []releaseCase{{
|
||||
name: "get values with a release",
|
||||
cmd: "get values thomas-guide",
|
||||
golden: "output/get-values.txt",
|
||||
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",
|
||||
wantError: true,
|
||||
}}
|
||||
testReleaseCmd(t, tests)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
shellwords "github.com/mattn/go-shellwords"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"k8s.io/helm/internal/test"
|
||||
"k8s.io/helm/pkg/hapi/release"
|
||||
"k8s.io/helm/pkg/helm"
|
||||
"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) {
|
||||
t.Helper()
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := &helm.FakeClient{
|
||||
Rels: tt.rels,
|
||||
Responses: tt.responses,
|
||||
Rels: tt.rels,
|
||||
TestRunStatus: tt.testRunStatus,
|
||||
}
|
||||
out, err := executeCommand(c, tt.cmd)
|
||||
if (err != nil) != tt.wantError {
|
||||
t.Errorf("expected error, got '%v'", err)
|
||||
}
|
||||
re := regexp.MustCompile(tt.matches)
|
||||
if !re.MatchString(out) {
|
||||
t.Errorf("expected\n%q\ngot\n%q", tt.matches, out)
|
||||
if tt.golden != "" {
|
||||
test.AssertGoldenString(t, out, tt.golden)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -76,15 +76,13 @@ func testReleaseCmd(t *testing.T, tests []releaseCase) {
|
|||
|
||||
// releaseCase describes a test case that works with releases.
|
||||
type releaseCase struct {
|
||||
name string
|
||||
cmd string
|
||||
// matches is the string to be matched. This supports regular expressions.
|
||||
matches string
|
||||
name string
|
||||
cmd string
|
||||
golden string
|
||||
wantError bool
|
||||
resp *release.Release
|
||||
// Rels are the available releases at the start of the test.
|
||||
rels []*release.Release
|
||||
responses map[string]release.TestRunStatus
|
||||
rels []*release.Release
|
||||
testRunStatus map[string]release.TestRunStatus
|
||||
}
|
||||
|
||||
// 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)
|
||||
if err := ensureTestHome(settings.Home, t); err != nil {
|
||||
if err := ensureTestHome(t, settings.Home); err != nil {
|
||||
return helmpath.Home("n/"), err
|
||||
}
|
||||
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.
|
||||
//
|
||||
// t is used only for logging.
|
||||
func ensureTestHome(home helmpath.Home, t *testing.T) error {
|
||||
configDirectories := []string{home.String(), home.Repository(), home.Cache(), home.Plugins(), home.Starters()}
|
||||
for _, p := range configDirectories {
|
||||
if fi, err := os.Stat(p); err != nil {
|
||||
if err := os.MkdirAll(p, 0755); err != nil {
|
||||
return fmt.Errorf("Could not create %s: %s", p, err)
|
||||
}
|
||||
} else if !fi.IsDir() {
|
||||
return fmt.Errorf("%s must be a directory", p)
|
||||
func ensureTestHome(t *testing.T, home helmpath.Home) error {
|
||||
t.Helper()
|
||||
for _, p := range []string{
|
||||
home.String(),
|
||||
home.Repository(),
|
||||
home.Cache(),
|
||||
home.Plugins(),
|
||||
home.Starters(),
|
||||
} {
|
||||
if err := os.MkdirAll(p, 0755); err != nil {
|
||||
return fmt.Errorf("Could not create %s: %s", p, err)
|
||||
}
|
||||
}
|
||||
|
||||
repoFile := home.RepositoryFile()
|
||||
if fi, err := os.Stat(repoFile); err != nil {
|
||||
if _, err := os.Stat(repoFile); err != nil {
|
||||
rf := repo.NewRepoFile()
|
||||
rf.Add(&repo.Entry{
|
||||
Name: "charts",
|
||||
|
|
@ -132,8 +132,6 @@ func ensureTestHome(home helmpath.Home, t *testing.T) error {
|
|||
if err := rf.WriteFile(repoFile, 0644); err != nil {
|
||||
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 {
|
||||
t.Log("Updating repository file format...")
|
||||
|
|
|
|||
|
|
@ -32,45 +32,40 @@ func TestHistoryCmd(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "get history for release",
|
||||
cmd: "history angry-bird",
|
||||
rels: []*rpb.Release{
|
||||
mk("angry-bird", 4, rpb.StatusDeployed),
|
||||
mk("angry-bird", 3, rpb.StatusSuperseded),
|
||||
mk("angry-bird", 2, 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`,
|
||||
tests := []releaseCase{{
|
||||
name: "get history for release",
|
||||
cmd: "history angry-bird",
|
||||
rels: []*rpb.Release{
|
||||
mk("angry-bird", 4, rpb.StatusDeployed),
|
||||
mk("angry-bird", 3, rpb.StatusSuperseded),
|
||||
mk("angry-bird", 2, rpb.StatusSuperseded),
|
||||
mk("angry-bird", 1, rpb.StatusSuperseded),
|
||||
},
|
||||
{
|
||||
name: "get history with max limit set",
|
||||
cmd: "history angry-bird --max 2",
|
||||
rels: []*rpb.Release{
|
||||
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.txt",
|
||||
}, {
|
||||
name: "get history with max limit set",
|
||||
cmd: "history angry-bird --max 2",
|
||||
rels: []*rpb.Release{
|
||||
mk("angry-bird", 4, rpb.StatusDeployed),
|
||||
mk("angry-bird", 3, rpb.StatusSuperseded),
|
||||
},
|
||||
{
|
||||
name: "get history with yaml output format",
|
||||
cmd: "history angry-bird --output yaml",
|
||||
rels: []*rpb.Release{
|
||||
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-limit.txt",
|
||||
}, {
|
||||
name: "get history with yaml output format",
|
||||
cmd: "history angry-bird --output yaml",
|
||||
rels: []*rpb.Release{
|
||||
mk("angry-bird", 4, rpb.StatusDeployed),
|
||||
mk("angry-bird", 3, rpb.StatusSuperseded),
|
||||
},
|
||||
{
|
||||
name: "get history with json output format",
|
||||
cmd: "history angry-bird --output json",
|
||||
rels: []*rpb.Release{
|
||||
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.yaml",
|
||||
}, {
|
||||
name: "get history with json output format",
|
||||
cmd: "history angry-bird --output json",
|
||||
rels: []*rpb.Release{
|
||||
mk("angry-bird", 4, rpb.StatusDeployed),
|
||||
mk("angry-bird", 3, rpb.StatusSuperseded),
|
||||
},
|
||||
}
|
||||
golden: "output/history.json",
|
||||
}}
|
||||
testReleaseCmd(t, tests)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,87 +20,76 @@ import (
|
|||
"reflect"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"k8s.io/helm/pkg/helm"
|
||||
)
|
||||
|
||||
func TestInstall(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
// Install, base case
|
||||
{
|
||||
name: "basic install",
|
||||
cmd: "install testdata/testcharts/alpine --name aeneas",
|
||||
matches: "aeneas",
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}),
|
||||
name: "basic install",
|
||||
cmd: "install testdata/testcharts/alpine --name aeneas",
|
||||
golden: "output/install.txt",
|
||||
},
|
||||
// Install, no hooks
|
||||
{
|
||||
name: "install without hooks",
|
||||
cmd: "install testdata/testcharts/alpine --name aeneas --no-hooks",
|
||||
matches: "aeneas",
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}),
|
||||
name: "install without hooks",
|
||||
cmd: "install testdata/testcharts/alpine --name aeneas --no-hooks",
|
||||
golden: "output/install-no-hooks.txt",
|
||||
},
|
||||
// Install, values from cli
|
||||
{
|
||||
name: "install with values",
|
||||
cmd: "install testdata/testcharts/alpine --name virgil --set foo=bar",
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil"}),
|
||||
matches: "virgil",
|
||||
name: "install with values",
|
||||
cmd: "install testdata/testcharts/alpine --name virgil --set foo=bar",
|
||||
golden: "output/install-with-values.txt",
|
||||
},
|
||||
// Install, values from cli via multiple --set
|
||||
{
|
||||
name: "install with multiple values",
|
||||
cmd: "install testdata/testcharts/alpine --name virgil --set foo=bar --set bar=foo",
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil"}),
|
||||
matches: "virgil",
|
||||
name: "install with multiple values",
|
||||
cmd: "install testdata/testcharts/alpine --name virgil --set foo=bar --set bar=foo",
|
||||
golden: "output/install-with-multiple-values.txt",
|
||||
},
|
||||
// Install, values from yaml
|
||||
{
|
||||
name: "install with values",
|
||||
cmd: "install testdata/testcharts/alpine --name virgil -f testdata/testcharts/alpine/extra_values.yaml",
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil"}),
|
||||
matches: "virgil",
|
||||
name: "install with values file",
|
||||
cmd: "install testdata/testcharts/alpine --name virgil -f testdata/testcharts/alpine/extra_values.yaml",
|
||||
golden: "output/install-with-values-file.txt",
|
||||
},
|
||||
// Install, values from multiple yaml
|
||||
{
|
||||
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",
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil"}),
|
||||
matches: "virgil",
|
||||
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",
|
||||
golden: "output/install-with-multiple-values-files.txt",
|
||||
},
|
||||
// Install, no charts
|
||||
{
|
||||
name: "install with no chart specified",
|
||||
cmd: "install",
|
||||
golden: "output/install-no-args.txt",
|
||||
wantError: true,
|
||||
},
|
||||
// Install, re-use name
|
||||
{
|
||||
name: "install and replace release",
|
||||
cmd: "install testdata/testcharts/alpine --name aeneas --replace",
|
||||
matches: "aeneas",
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}),
|
||||
name: "install and replace release",
|
||||
cmd: "install testdata/testcharts/alpine --name aeneas --replace",
|
||||
golden: "output/install-and-replace.txt",
|
||||
},
|
||||
// Install, with timeout
|
||||
{
|
||||
name: "install with a timeout",
|
||||
cmd: "install testdata/testcharts/alpine --name foobar --timeout 120",
|
||||
matches: "foobar",
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "foobar"}),
|
||||
name: "install with a timeout",
|
||||
cmd: "install testdata/testcharts/alpine --name foobar --timeout 120",
|
||||
golden: "output/install-with-timeout.txt",
|
||||
},
|
||||
// Install, with wait
|
||||
{
|
||||
name: "install with a wait",
|
||||
cmd: "install testdata/testcharts/alpine --name apollo --wait",
|
||||
matches: "apollo",
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "apollo"}),
|
||||
name: "install with a wait",
|
||||
cmd: "install testdata/testcharts/alpine --name apollo --wait",
|
||||
golden: "output/install-with-wait.txt",
|
||||
},
|
||||
// Install, using the name-template
|
||||
{
|
||||
name: "install with name-template",
|
||||
cmd: "install testdata/testcharts/alpine --name-template '{{upper \"foobar\"}}'",
|
||||
matches: "FOOBAR",
|
||||
resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "FOOBAR"}),
|
||||
name: "install with name-template",
|
||||
cmd: "install testdata/testcharts/alpine --name-template '{{upper \"foobar\"}}'",
|
||||
golden: "output/install-name-template.txt",
|
||||
},
|
||||
// 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 {
|
||||
sortBy := hapi.ListSortName
|
||||
sortBy := hapi.SortByName
|
||||
if l.byDate {
|
||||
sortBy = hapi.ListSortLastReleased
|
||||
sortBy = hapi.SortByLastReleased
|
||||
}
|
||||
|
||||
sortOrder := hapi.ListSortAsc
|
||||
sortOrder := hapi.SortAsc
|
||||
if l.sortDesc {
|
||||
sortOrder = hapi.ListSortDesc
|
||||
sortOrder = hapi.SortDesc
|
||||
}
|
||||
|
||||
stats := l.statusCodes()
|
||||
|
|
|
|||
|
|
@ -24,103 +24,92 @@ import (
|
|||
)
|
||||
|
||||
func TestListCmd(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "with a release",
|
||||
cmd: "list",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}),
|
||||
},
|
||||
matches: "thomas-guide",
|
||||
tests := []releaseCase{{
|
||||
name: "with a release",
|
||||
cmd: "list",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}),
|
||||
},
|
||||
{
|
||||
name: "list",
|
||||
cmd: "list",
|
||||
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-with-release.txt",
|
||||
}, {
|
||||
name: "list",
|
||||
cmd: "list",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}),
|
||||
},
|
||||
{
|
||||
name: "list, one deployed, one failed",
|
||||
cmd: "list -q",
|
||||
rels: []*release.Release{
|
||||
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.txt",
|
||||
}, {
|
||||
name: "list, one deployed, one failed",
|
||||
cmd: "list -q",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusFailed}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
|
||||
},
|
||||
{
|
||||
name: "with a release, multiple flags",
|
||||
cmd: "list --deleted --deployed --failed -q",
|
||||
rels: []*release.Release{
|
||||
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",
|
||||
golden: "output/list-with-failed.txt",
|
||||
}, {
|
||||
name: "with a release, multiple flags",
|
||||
cmd: "list --deleted --deployed --failed -q",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleted}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
|
||||
},
|
||||
{
|
||||
name: "with a release, multiple flags",
|
||||
cmd: "list --all -q",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleted}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
|
||||
},
|
||||
// See note on previous test.
|
||||
matches: "thomas-guide\natlas-guide",
|
||||
// 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.
|
||||
golden: "output/list-with-mulitple-flags.txt",
|
||||
}, {
|
||||
name: "with a release, multiple flags",
|
||||
cmd: "list --all -q",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleted}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
|
||||
},
|
||||
{
|
||||
name: "with a release, multiple flags, deleting",
|
||||
cmd: "list --all -q",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleting}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
|
||||
},
|
||||
// See note on previous test.
|
||||
matches: "thomas-guide\natlas-guide",
|
||||
// See note on previous test.
|
||||
golden: "output/list-with-mulitple-flags2.txt",
|
||||
}, {
|
||||
name: "with a release, multiple flags, deleting",
|
||||
cmd: "list --all -q",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleting}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
|
||||
},
|
||||
{
|
||||
name: "namespace defined, multiple flags",
|
||||
cmd: "list --all -q --namespace test123",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Namespace: "test123"}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Namespace: "test321"}),
|
||||
},
|
||||
// See note on previous test.
|
||||
matches: "thomas-guide",
|
||||
// See note on previous test.
|
||||
golden: "output/list-with-mulitple-flags-deleting.txt",
|
||||
}, {
|
||||
name: "namespace defined, multiple flags",
|
||||
cmd: "list --all -q --namespace test123",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Namespace: "test123"}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Namespace: "test321"}),
|
||||
},
|
||||
{
|
||||
name: "with a pending release, multiple flags",
|
||||
cmd: "list --all -q",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusPendingInstall}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
|
||||
},
|
||||
matches: "thomas-guide\natlas-guide",
|
||||
// See note on previous test.
|
||||
golden: "output/list-with-mulitple-flags-namespaced.txt",
|
||||
}, {
|
||||
name: "with a pending release, multiple flags",
|
||||
cmd: "list --all -q",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusPendingInstall}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
|
||||
},
|
||||
{
|
||||
name: "with a pending release, pending flag",
|
||||
cmd: "list --pending -q",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusPendingInstall}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "wild-idea", Status: release.StatusPendingUpgrade}),
|
||||
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-mulitple-flags-pending.txt",
|
||||
}, {
|
||||
name: "with a pending release, pending flag",
|
||||
cmd: "list --pending -q",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusPendingInstall}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "wild-idea", Status: release.StatusPendingUpgrade}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-maps", Status: release.StatusPendingRollback}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
|
||||
},
|
||||
{
|
||||
name: "with old releases",
|
||||
cmd: "list",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusFailed}),
|
||||
},
|
||||
matches: "thomas-guide",
|
||||
golden: "output/list-with-pending.txt",
|
||||
}, {
|
||||
name: "with old releases",
|
||||
cmd: "list",
|
||||
rels: []*release.Release{
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}),
|
||||
helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusFailed}),
|
||||
},
|
||||
}
|
||||
golden: "output/list-with-old-releases.txt",
|
||||
}}
|
||||
|
||||
testReleaseCmd(t, tests)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ func TestPackage(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
ensureTestHome(helmpath.Home(tmp), t)
|
||||
ensureTestHome(t, helmpath.Home(tmp))
|
||||
cleanup := resetEnv()
|
||||
defer func() {
|
||||
os.Chdir(origDir)
|
||||
|
|
|
|||
|
|
@ -23,49 +23,44 @@ import (
|
|||
)
|
||||
|
||||
func TestReleaseTesting(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "basic test",
|
||||
cmd: "test example-release",
|
||||
responses: map[string]release.TestRunStatus{"PASSED: green lights everywhere": release.TestRunSuccess},
|
||||
wantError: false,
|
||||
},
|
||||
{
|
||||
name: "test failure",
|
||||
cmd: "test example-fail",
|
||||
responses: map[string]release.TestRunStatus{"FAILURE: red lights everywhere": release.TestRunFailure},
|
||||
wantError: true,
|
||||
},
|
||||
{
|
||||
name: "test unknown",
|
||||
cmd: "test example-unknown",
|
||||
responses: map[string]release.TestRunStatus{"UNKNOWN: yellow lights everywhere": release.TestRunUnknown},
|
||||
wantError: false,
|
||||
},
|
||||
{
|
||||
name: "test error",
|
||||
cmd: "test example-error",
|
||||
responses: map[string]release.TestRunStatus{"ERROR: yellow lights everywhere": release.TestRunFailure},
|
||||
wantError: true,
|
||||
},
|
||||
{
|
||||
name: "test running",
|
||||
cmd: "test example-running",
|
||||
responses: map[string]release.TestRunStatus{"RUNNING: things are happpeningggg": release.TestRunRunning},
|
||||
wantError: false,
|
||||
},
|
||||
{
|
||||
name: "multiple tests example",
|
||||
cmd: "test example-suite",
|
||||
responses: map[string]release.TestRunStatus{
|
||||
"RUNNING: things are happpeningggg": release.TestRunRunning,
|
||||
"PASSED: party time": release.TestRunSuccess,
|
||||
"RUNNING: things are happening again": release.TestRunRunning,
|
||||
"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,
|
||||
},
|
||||
}
|
||||
tests := []releaseCase{{
|
||||
name: "basic test",
|
||||
cmd: "test example-release",
|
||||
testRunStatus: map[string]release.TestRunStatus{"PASSED: green lights everywhere": release.TestRunSuccess},
|
||||
golden: "output/test.txt",
|
||||
}, {
|
||||
name: "test failure",
|
||||
cmd: "test example-fail",
|
||||
testRunStatus: map[string]release.TestRunStatus{"FAILURE: red lights everywhere": release.TestRunFailure},
|
||||
wantError: true,
|
||||
golden: "output/test-failure.txt",
|
||||
}, {
|
||||
name: "test unknown",
|
||||
cmd: "test example-unknown",
|
||||
testRunStatus: map[string]release.TestRunStatus{"UNKNOWN: yellow lights everywhere": release.TestRunUnknown},
|
||||
golden: "output/test-unknown.txt",
|
||||
}, {
|
||||
name: "test error",
|
||||
cmd: "test example-error",
|
||||
testRunStatus: map[string]release.TestRunStatus{"ERROR: yellow lights everywhere": release.TestRunFailure},
|
||||
wantError: true,
|
||||
golden: "output/test-error.txt",
|
||||
}, {
|
||||
name: "test running",
|
||||
cmd: "test example-running",
|
||||
testRunStatus: map[string]release.TestRunStatus{"RUNNING: things are happpeningggg": release.TestRunRunning},
|
||||
golden: "output/test-running.txt",
|
||||
}, {
|
||||
name: "multiple tests example",
|
||||
cmd: "test example-suite",
|
||||
testRunStatus: map[string]release.TestRunStatus{
|
||||
"RUNNING: things are happpeningggg": release.TestRunRunning,
|
||||
"PASSED: party time": release.TestRunSuccess,
|
||||
"RUNNING: things are happening again": release.TestRunRunning,
|
||||
"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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ import (
|
|||
"k8s.io/helm/pkg/repo/repotest"
|
||||
)
|
||||
|
||||
var testName = "test-name"
|
||||
|
||||
func TestRepoAddCmd(t *testing.T) {
|
||||
srv, thome, err := repotest.NewTempServer("testdata/testserver/*.*")
|
||||
if err != nil {
|
||||
|
|
@ -39,16 +37,16 @@ func TestRepoAddCmd(t *testing.T) {
|
|||
os.RemoveAll(thome.String())
|
||||
cleanup()
|
||||
}()
|
||||
if err := ensureTestHome(thome, t); err != nil {
|
||||
if err := ensureTestHome(t, thome); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
settings.Home = thome
|
||||
|
||||
tests := []releaseCase{{
|
||||
name: "add a repository",
|
||||
cmd: fmt.Sprintf("repo add %s %s --home %s", testName, srv.URL(), thome),
|
||||
matches: "\"" + testName + "\" has been added to your repositories",
|
||||
name: "add a repository",
|
||||
cmd: fmt.Sprintf("repo add test-name %s --home %s", srv.URL(), thome),
|
||||
golden: "output/repo-add.txt",
|
||||
}}
|
||||
|
||||
testReleaseCmd(t, tests)
|
||||
|
|
@ -67,13 +65,15 @@ func TestRepoAdd(t *testing.T) {
|
|||
os.RemoveAll(thome.String())
|
||||
cleanup()
|
||||
}()
|
||||
if err := ensureTestHome(hh, t); err != nil {
|
||||
if err := ensureTestHome(t, hh); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
@ -82,15 +82,15 @@ func TestRepoAdd(t *testing.T) {
|
|||
t.Error(err)
|
||||
}
|
||||
|
||||
if !f.Has(testName) {
|
||||
t.Errorf("%s was not successfully inserted into %s", testName, hh.RepositoryFile())
|
||||
if !f.Has(testRepoName) {
|
||||
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)
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,34 +40,35 @@ func TestRepoRemove(t *testing.T) {
|
|||
os.RemoveAll(thome.String())
|
||||
cleanup()
|
||||
}()
|
||||
if err := ensureTestHome(hh, t); err != nil {
|
||||
if err := ensureTestHome(t, hh); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
settings.Home = thome
|
||||
|
||||
b := bytes.NewBuffer(nil)
|
||||
const testRepoName = "test-name"
|
||||
|
||||
if err := removeRepoLine(b, testName, hh); err == nil {
|
||||
t.Errorf("Expected error removing %s, but did not get one.", testName)
|
||||
b := bytes.NewBuffer(nil)
|
||||
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)
|
||||
}
|
||||
|
||||
mf, _ := os.Create(hh.CacheIndex(testName))
|
||||
mf, _ := os.Create(hh.CacheIndex(testRepoName))
|
||||
mf.Close()
|
||||
|
||||
b.Reset()
|
||||
if err := removeRepoLine(b, testName, hh); err != nil {
|
||||
t.Errorf("Error removing %s from repositories", testName)
|
||||
if err := removeRepoLine(b, testRepoName, hh); err != nil {
|
||||
t.Errorf("Error removing %s from repositories", testRepoName)
|
||||
}
|
||||
if !strings.Contains(b.String(), "has been removed") {
|
||||
t.Errorf("Unexpected output: %s", b.String())
|
||||
}
|
||||
|
||||
if _, err := os.Stat(hh.CacheIndex(testName)); err == nil {
|
||||
t.Errorf("Error cache file was not removed for repository %s", testName)
|
||||
if _, err := os.Stat(hh.CacheIndex(testRepoName)); err == nil {
|
||||
t.Errorf("Error cache file was not removed for repository %s", testRepoName)
|
||||
}
|
||||
|
||||
f, err := repo.LoadRepositoriesFile(hh.RepositoryFile())
|
||||
|
|
@ -75,7 +76,7 @@ func TestRepoRemove(t *testing.T) {
|
|||
t.Error(err)
|
||||
}
|
||||
|
||||
if f.Has(testName) {
|
||||
t.Errorf("%s was not successfully removed from repositories list", testName)
|
||||
if f.Has(testRepoName) {
|
||||
t.Errorf("%s was not successfully removed from repositories list", testRepoName)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ func TestUpdateCharts(t *testing.T) {
|
|||
os.RemoveAll(thome.String())
|
||||
cleanup()
|
||||
}()
|
||||
if err := ensureTestHome(hh, t); err != nil {
|
||||
if err := ensureTestHome(t, hh); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,28 +21,23 @@ import (
|
|||
)
|
||||
|
||||
func TestRollbackCmd(t *testing.T) {
|
||||
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "rollback a release",
|
||||
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",
|
||||
matches: "Rollback was a success! Happy Helming!",
|
||||
},
|
||||
{
|
||||
name: "rollback a release with wait",
|
||||
cmd: "rollback funny-honey 1 --wait",
|
||||
matches: "Rollback was a success! Happy Helming!",
|
||||
},
|
||||
{
|
||||
name: "rollback a release without revision",
|
||||
cmd: "rollback funny-honey",
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
tests := []releaseCase{{
|
||||
name: "rollback a release",
|
||||
cmd: "rollback funny-honey 1",
|
||||
golden: "output/rollback.txt",
|
||||
}, {
|
||||
name: "rollback a release with timeout",
|
||||
cmd: "rollback funny-honey 1 --timeout 120",
|
||||
golden: "output/rollback-timeout.txt",
|
||||
}, {
|
||||
name: "rollback a release with wait",
|
||||
cmd: "rollback funny-honey 1 --wait",
|
||||
golden: "output/rollback-wait.txt",
|
||||
}, {
|
||||
name: "rollback a release without revision",
|
||||
cmd: "rollback funny-honey",
|
||||
golden: "output/rollback-no-args.txt",
|
||||
wantError: true,
|
||||
}}
|
||||
testReleaseCmd(t, tests)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,58 +21,47 @@ import (
|
|||
)
|
||||
|
||||
func TestSearchCmd(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "search for 'maria', expect one match",
|
||||
cmd: "search maria",
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
},
|
||||
{
|
||||
name: "search for 'alpine' with version constraint, expect one match with version 0.1.0",
|
||||
cmd: "search alpine --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",
|
||||
},
|
||||
{
|
||||
name: "search for 'alpine' with version constraint, expect one match with version 0.1.0",
|
||||
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",
|
||||
},
|
||||
{
|
||||
name: "search for 'alpine' with version constraint, expect one match with version 0.2.0",
|
||||
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 'alpine' with version constraint and --versions, expect two matches",
|
||||
cmd: "search alpine --versions --version '>= 0.1'",
|
||||
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",
|
||||
},
|
||||
{
|
||||
name: "search for 'syzygy', expect no matches",
|
||||
cmd: "search syzygy",
|
||||
matches: "No results found",
|
||||
},
|
||||
{
|
||||
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,
|
||||
},
|
||||
}
|
||||
tests := []releaseCase{{
|
||||
name: "search for 'maria', expect one match",
|
||||
cmd: "search maria",
|
||||
golden: "output/search-single.txt",
|
||||
}, {
|
||||
name: "search for 'alpine', expect two matches",
|
||||
cmd: "search alpine",
|
||||
golden: "output/search-multiple.txt",
|
||||
}, {
|
||||
name: "search for 'alpine' with versions, expect three matches",
|
||||
cmd: "search alpine --versions",
|
||||
golden: "output/search-multiple-versions.txt",
|
||||
}, {
|
||||
name: "search for 'alpine' with version constraint, expect one match with version 0.1.0",
|
||||
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",
|
||||
cmd: "search alpine --versions --version '>= 0.1, < 0.2'",
|
||||
golden: "output/search-versions-constraint.txt",
|
||||
}, {
|
||||
name: "search for 'alpine' with version constraint, expect one match with version 0.2.0",
|
||||
cmd: "search alpine --version '>= 0.1'",
|
||||
golden: "output/search-constraint-single.txt",
|
||||
}, {
|
||||
name: "search for 'alpine' with version constraint and --versions, expect two matches",
|
||||
cmd: "search alpine --versions --version '>= 0.1'",
|
||||
golden: "output/search-multiple-versions-constraints.txt",
|
||||
}, {
|
||||
name: "search for 'syzygy', expect no matches",
|
||||
cmd: "search syzygy",
|
||||
golden: "output/search-not-found.txt",
|
||||
}, {
|
||||
name: "search for 'alp[a-z]+', expect two matches",
|
||||
cmd: "search alp[a-z]+ --regexp",
|
||||
golden: "output/search-regex.txt",
|
||||
}, {
|
||||
name: "search for 'alp[', expect failure to compile regexp",
|
||||
cmd: "search alp[ --regexp",
|
||||
wantError: true,
|
||||
}}
|
||||
|
||||
cleanup := resetEnv()
|
||||
defer cleanup()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -25,107 +24,70 @@ import (
|
|||
)
|
||||
|
||||
func TestStatusCmd(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "get status of a deployed release",
|
||||
cmd: "status flummoxed-chickadee",
|
||||
matches: outputWithStatus("deployed"),
|
||||
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(),
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
releasesMockWithStatus := func(info *release.Info) []*release.Release {
|
||||
info.LastDeployed = time.Unix(1452902400, 0)
|
||||
return []*release.Release{{
|
||||
Name: "flummoxed-chickadee",
|
||||
Info: info,
|
||||
}}
|
||||
}
|
||||
|
||||
tests := []releaseCase{{
|
||||
name: "get status of a deployed release",
|
||||
cmd: "status flummoxed-chickadee",
|
||||
golden: "output/status.txt",
|
||||
rels: releasesMockWithStatus(&release.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)
|
||||
}
|
||||
|
||||
func outputWithStatus(status string) string {
|
||||
return fmt.Sprintf(`LAST DEPLOYED:(.*)\nNAMESPACE: \nSTATUS: %s`, status)
|
||||
}
|
||||
|
||||
func releaseMockWithStatus(info *release.Info) *release.Release {
|
||||
info.FirstDeployed = time.Now()
|
||||
info.LastDeployed = time.Now()
|
||||
return &release.Release{
|
||||
Name: "flummoxed-chickadee",
|
||||
Info: info,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1
cmd/helm/testdata/output/delete-no-args.txt
vendored
Normal file
1
cmd/helm/testdata/output/delete-no-args.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Error: command 'delete' requires a release name
|
||||
1
cmd/helm/testdata/output/delete-no-hooks.txt
vendored
Normal file
1
cmd/helm/testdata/output/delete-no-hooks.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
release "aeneas" deleted
|
||||
1
cmd/helm/testdata/output/delete-purge.txt
vendored
Normal file
1
cmd/helm/testdata/output/delete-purge.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
release "aeneas" deleted
|
||||
1
cmd/helm/testdata/output/delete-timeout.txt
vendored
Normal file
1
cmd/helm/testdata/output/delete-timeout.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
release "aeneas" deleted
|
||||
1
cmd/helm/testdata/output/delete.txt
vendored
Normal file
1
cmd/helm/testdata/output/delete.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
release "aeneas" deleted
|
||||
4
cmd/helm/testdata/output/dependency-list-archive.txt
vendored
Normal file
4
cmd/helm/testdata/output/dependency-list-archive.txt
vendored
Normal file
|
|
@ -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
|
||||
|
||||
1
cmd/helm/testdata/output/dependency-list-no-chart.txt
vendored
Normal file
1
cmd/helm/testdata/output/dependency-list-no-chart.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Error: stat /no/such/chart: no such file or directory
|
||||
1
cmd/helm/testdata/output/dependency-list-no-requirements.txt
vendored
Normal file
1
cmd/helm/testdata/output/dependency-list-no-requirements.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
WARNING: no requirements at testdata/testcharts/alpine/charts
|
||||
5
cmd/helm/testdata/output/dependency-list.txt
vendored
Normal file
5
cmd/helm/testdata/output/dependency-list.txt
vendored
Normal file
|
|
@ -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
|
||||
|
||||
1
cmd/helm/testdata/output/get-hooks-no-args.txt
vendored
Normal file
1
cmd/helm/testdata/output/get-hooks-no-args.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Error: release name is required
|
||||
7
cmd/helm/testdata/output/get-hooks.txt
vendored
Normal file
7
cmd/helm/testdata/output/get-hooks.txt
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
# pre-install-hook
|
||||
apiVersion: v1
|
||||
kind: Job
|
||||
metadata:
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install
|
||||
1
cmd/helm/testdata/output/get-manifest-no-args.txt
vendored
Normal file
1
cmd/helm/testdata/output/get-manifest-no-args.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Error: release name is required
|
||||
5
cmd/helm/testdata/output/get-manifest.txt
vendored
Normal file
5
cmd/helm/testdata/output/get-manifest.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: fixture
|
||||
|
||||
1
cmd/helm/testdata/output/get-no-args.txt
vendored
Normal file
1
cmd/helm/testdata/output/get-no-args.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Error: release name is required
|
||||
23
cmd/helm/testdata/output/get-release.txt
vendored
Normal file
23
cmd/helm/testdata/output/get-release.txt
vendored
Normal file
|
|
@ -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
|
||||
|
||||
1
cmd/helm/testdata/output/get-values-args.txt
vendored
Normal file
1
cmd/helm/testdata/output/get-values-args.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Error: release name is required
|
||||
1
cmd/helm/testdata/output/get-values.txt
vendored
Normal file
1
cmd/helm/testdata/output/get-values.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
name: "value"
|
||||
3
cmd/helm/testdata/output/history-limit.txt
vendored
Normal file
3
cmd/helm/testdata/output/history-limit.txt
vendored
Normal file
|
|
@ -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
|
||||
1
cmd/helm/testdata/output/history.json
vendored
Normal file
1
cmd/helm/testdata/output/history.json
vendored
Normal file
|
|
@ -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"}]
|
||||
5
cmd/helm/testdata/output/history.txt
vendored
Normal file
5
cmd/helm/testdata/output/history.txt
vendored
Normal file
|
|
@ -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
|
||||
11
cmd/helm/testdata/output/history.yaml
vendored
Normal file
11
cmd/helm/testdata/output/history.yaml
vendored
Normal file
|
|
@ -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
|
||||
|
||||
5
cmd/helm/testdata/output/install-and-replace.txt
vendored
Normal file
5
cmd/helm/testdata/output/install-and-replace.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
NAME: aeneas
|
||||
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
|
||||
5
cmd/helm/testdata/output/install-name-template.txt
vendored
Normal file
5
cmd/helm/testdata/output/install-name-template.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
NAME: FOOBAR
|
||||
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
|
||||
1
cmd/helm/testdata/output/install-no-args.txt
vendored
Normal file
1
cmd/helm/testdata/output/install-no-args.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Error: This command needs 1 argument: chart name
|
||||
5
cmd/helm/testdata/output/install-no-hooks.txt
vendored
Normal file
5
cmd/helm/testdata/output/install-no-hooks.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
NAME: aeneas
|
||||
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
|
||||
5
cmd/helm/testdata/output/install-with-multiple-values-files.txt
vendored
Normal file
5
cmd/helm/testdata/output/install-with-multiple-values-files.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
NAME: virgil
|
||||
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
|
||||
5
cmd/helm/testdata/output/install-with-multiple-values.txt
vendored
Normal file
5
cmd/helm/testdata/output/install-with-multiple-values.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
NAME: virgil
|
||||
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
|
||||
5
cmd/helm/testdata/output/install-with-timeout.txt
vendored
Normal file
5
cmd/helm/testdata/output/install-with-timeout.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
NAME: foobar
|
||||
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
|
||||
5
cmd/helm/testdata/output/install-with-values-file.txt
vendored
Normal file
5
cmd/helm/testdata/output/install-with-values-file.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
NAME: virgil
|
||||
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
|
||||
5
cmd/helm/testdata/output/install-with-values.txt
vendored
Normal file
5
cmd/helm/testdata/output/install-with-values.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
NAME: virgil
|
||||
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
|
||||
5
cmd/helm/testdata/output/install-with-wait.txt
vendored
Normal file
5
cmd/helm/testdata/output/install-with-wait.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
NAME: apollo
|
||||
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
|
||||
5
cmd/helm/testdata/output/install.txt
vendored
Normal file
5
cmd/helm/testdata/output/install.txt
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
NAME: aeneas
|
||||
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
|
||||
2
cmd/helm/testdata/output/list-with-failed.txt
vendored
Normal file
2
cmd/helm/testdata/output/list-with-failed.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
thomas-guide
|
||||
atlas-guide
|
||||
2
cmd/helm/testdata/output/list-with-mulitple-flags-deleting.txt
vendored
Normal file
2
cmd/helm/testdata/output/list-with-mulitple-flags-deleting.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
thomas-guide
|
||||
atlas-guide
|
||||
2
cmd/helm/testdata/output/list-with-mulitple-flags-namespaced.txt
vendored
Normal file
2
cmd/helm/testdata/output/list-with-mulitple-flags-namespaced.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
thomas-guide
|
||||
atlas-guide
|
||||
2
cmd/helm/testdata/output/list-with-mulitple-flags-pending.txt
vendored
Normal file
2
cmd/helm/testdata/output/list-with-mulitple-flags-pending.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
thomas-guide
|
||||
atlas-guide
|
||||
2
cmd/helm/testdata/output/list-with-mulitple-flags.txt
vendored
Normal file
2
cmd/helm/testdata/output/list-with-mulitple-flags.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
thomas-guide
|
||||
atlas-guide
|
||||
2
cmd/helm/testdata/output/list-with-mulitple-flags2.txt
vendored
Normal file
2
cmd/helm/testdata/output/list-with-mulitple-flags2.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
thomas-guide
|
||||
atlas-guide
|
||||
2
cmd/helm/testdata/output/list-with-namespace.txt
vendored
Normal file
2
cmd/helm/testdata/output/list-with-namespace.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
thomas-guide
|
||||
atlas-guide
|
||||
3
cmd/helm/testdata/output/list-with-old-releases.txt
vendored
Normal file
3
cmd/helm/testdata/output/list-with-old-releases.txt
vendored
Normal file
|
|
@ -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
|
||||
4
cmd/helm/testdata/output/list-with-pending.txt
vendored
Normal file
4
cmd/helm/testdata/output/list-with-pending.txt
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
thomas-guide
|
||||
wild-idea
|
||||
crazy-maps
|
||||
atlas-guide
|
||||
2
cmd/helm/testdata/output/list-with-release.txt
vendored
Normal file
2
cmd/helm/testdata/output/list-with-release.txt
vendored
Normal file
|
|
@ -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
|
||||
2
cmd/helm/testdata/output/list.txt
vendored
Normal file
2
cmd/helm/testdata/output/list.txt
vendored
Normal file
|
|
@ -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
|
||||
1
cmd/helm/testdata/output/repo-add.txt
vendored
Normal file
1
cmd/helm/testdata/output/repo-add.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
"test-name" has been added to your repositories
|
||||
1
cmd/helm/testdata/output/rollback-no-args.txt
vendored
Normal file
1
cmd/helm/testdata/output/rollback-no-args.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Error: This command needs 2 arguments: release name, revision number
|
||||
1
cmd/helm/testdata/output/rollback-timeout.txt
vendored
Normal file
1
cmd/helm/testdata/output/rollback-timeout.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Rollback was a success! Happy Helming!
|
||||
1
cmd/helm/testdata/output/rollback-wait.txt
vendored
Normal file
1
cmd/helm/testdata/output/rollback-wait.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Rollback was a success! Happy Helming!
|
||||
1
cmd/helm/testdata/output/rollback.txt
vendored
Normal file
1
cmd/helm/testdata/output/rollback.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Rollback was a success! Happy Helming!
|
||||
2
cmd/helm/testdata/output/search-constraint-single.txt
vendored
Normal file
2
cmd/helm/testdata/output/search-constraint-single.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
NAME CHART VERSION APP VERSION DESCRIPTION
|
||||
testing/alpine 0.2.0 2.3.4 Deploy a basic Alpine Linux pod
|
||||
2
cmd/helm/testdata/output/search-constraint.txt
vendored
Normal file
2
cmd/helm/testdata/output/search-constraint.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
NAME CHART VERSION APP VERSION DESCRIPTION
|
||||
testing/alpine 0.1.0 1.2.3 Deploy a basic Alpine Linux pod
|
||||
3
cmd/helm/testdata/output/search-multiple-versions-constraints.txt
vendored
Normal file
3
cmd/helm/testdata/output/search-multiple-versions-constraints.txt
vendored
Normal file
|
|
@ -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
|
||||
3
cmd/helm/testdata/output/search-multiple-versions.txt
vendored
Normal file
3
cmd/helm/testdata/output/search-multiple-versions.txt
vendored
Normal file
|
|
@ -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
|
||||
2
cmd/helm/testdata/output/search-multiple.txt
vendored
Normal file
2
cmd/helm/testdata/output/search-multiple.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
NAME CHART VERSION APP VERSION DESCRIPTION
|
||||
testing/alpine 0.2.0 2.3.4 Deploy a basic Alpine Linux pod
|
||||
1
cmd/helm/testdata/output/search-not-found.txt
vendored
Normal file
1
cmd/helm/testdata/output/search-not-found.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
No results found
|
||||
2
cmd/helm/testdata/output/search-regex.txt
vendored
Normal file
2
cmd/helm/testdata/output/search-regex.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
NAME CHART VERSION APP VERSION DESCRIPTION
|
||||
testing/alpine 0.2.0 2.3.4 Deploy a basic Alpine Linux pod
|
||||
2
cmd/helm/testdata/output/search-single.txt
vendored
Normal file
2
cmd/helm/testdata/output/search-single.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
NAME CHART VERSION APP VERSION DESCRIPTION
|
||||
testing/mariadb 0.3.0 Chart for MariaDB
|
||||
2
cmd/helm/testdata/output/search-versions-constraint.txt
vendored
Normal file
2
cmd/helm/testdata/output/search-versions-constraint.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
NAME CHART VERSION APP VERSION DESCRIPTION
|
||||
testing/alpine 0.1.0 1.2.3 Deploy a basic Alpine Linux pod
|
||||
6
cmd/helm/testdata/output/status-with-notes.txt
vendored
Normal file
6
cmd/helm/testdata/output/status-with-notes.txt
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC
|
||||
NAMESPACE:
|
||||
STATUS: deployed
|
||||
|
||||
NOTES:
|
||||
release notes
|
||||
8
cmd/helm/testdata/output/status-with-resource.txt
vendored
Normal file
8
cmd/helm/testdata/output/status-with-resource.txt
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC
|
||||
NAMESPACE:
|
||||
STATUS: deployed
|
||||
|
||||
RESOURCES:
|
||||
resource A
|
||||
resource B
|
||||
|
||||
11
cmd/helm/testdata/output/status-with-test-suite.txt
vendored
Normal file
11
cmd/helm/testdata/output/status-with-test-suite.txt
vendored
Normal file
|
|
@ -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
|
||||
1
cmd/helm/testdata/output/status.json
vendored
Normal file
1
cmd/helm/testdata/output/status.json
vendored
Normal file
|
|
@ -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"}}
|
||||
4
cmd/helm/testdata/output/status.txt
vendored
Normal file
4
cmd/helm/testdata/output/status.txt
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC
|
||||
NAMESPACE:
|
||||
STATUS: deployed
|
||||
|
||||
9
cmd/helm/testdata/output/status.yaml
vendored
Normal file
9
cmd/helm/testdata/output/status.yaml
vendored
Normal file
|
|
@ -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
|
||||
2
cmd/helm/testdata/output/test-error.txt
vendored
Normal file
2
cmd/helm/testdata/output/test-error.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
ERROR: yellow lights everywhere
|
||||
Error: 1 test(s) failed
|
||||
2
cmd/helm/testdata/output/test-failure.txt
vendored
Normal file
2
cmd/helm/testdata/output/test-failure.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
FAILURE: red lights everywhere
|
||||
Error: 1 test(s) failed
|
||||
1
cmd/helm/testdata/output/test-running.txt
vendored
Normal file
1
cmd/helm/testdata/output/test-running.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
RUNNING: things are happpeningggg
|
||||
1
cmd/helm/testdata/output/test-unknown.txt
vendored
Normal file
1
cmd/helm/testdata/output/test-unknown.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
UNKNOWN: yellow lights everywhere
|
||||
1
cmd/helm/testdata/output/test.txt
vendored
Normal file
1
cmd/helm/testdata/output/test.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
PASSED: green lights everywhere
|
||||
1
cmd/helm/testdata/output/upgrade-with-bad-dependencies.txt
vendored
Normal file
1
cmd/helm/testdata/output/upgrade-with-bad-dependencies.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Error: cannot load requirements: error converting YAML to JSON: yaml: line 2: did not find expected '-' indicator
|
||||
49
cmd/helm/testdata/output/upgrade-with-install-timeout.txt
vendored
Normal file
49
cmd/helm/testdata/output/upgrade-with-install-timeout.txt
vendored
Normal file
|
|
@ -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
|
||||
|
||||
49
cmd/helm/testdata/output/upgrade-with-install.txt
vendored
Normal file
49
cmd/helm/testdata/output/upgrade-with-install.txt
vendored
Normal file
|
|
@ -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
|
||||
|
||||
1
cmd/helm/testdata/output/upgrade-with-missing-dependencies.txt
vendored
Normal file
1
cmd/helm/testdata/output/upgrade-with-missing-dependencies.txt
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
Error: This command needs 2 arguments: release name, chart path
|
||||
49
cmd/helm/testdata/output/upgrade-with-reset-values.txt
vendored
Normal file
49
cmd/helm/testdata/output/upgrade-with-reset-values.txt
vendored
Normal file
|
|
@ -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
|
||||
|
||||
49
cmd/helm/testdata/output/upgrade-with-reset-values2.txt
vendored
Normal file
49
cmd/helm/testdata/output/upgrade-with-reset-values2.txt
vendored
Normal file
|
|
@ -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…
Reference in a new issue