MCPcopy
hub / github.com/helm/helm / TestMemoryCreate

Function TestMemoryCreate

pkg/storage/driver/memory_test.go:37–78  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestMemoryCreate(t *testing.T) {
38 var tests = []struct {
39 desc string
40 rls *rspb.Release
41 err bool
42 }{
43 {
44 "create should succeed",
45 releaseStub("rls-c", 1, "default", common.StatusDeployed),
46 false,
47 },
48 {
49 "create should fail (release already exists)",
50 releaseStub("rls-a", 1, "default", common.StatusDeployed),
51 true,
52 },
53 {
54 "create in namespace should succeed",
55 releaseStub("rls-a", 1, "mynamespace", common.StatusDeployed),
56 false,
57 },
58 {
59 "create in other namespace should fail (release already exists)",
60 releaseStub("rls-c", 1, "mynamespace", common.StatusDeployed),
61 true,
62 },
63 }
64
65 ts := tsFixtureMemory(t)
66 for _, tt := range tests {
67 key := testKey(tt.rls.Name, tt.rls.Version)
68 rls := tt.rls
69
70 if err := ts.Create(key, rls); err != nil {
71 if !tt.err {
72 t.Fatalf("failed to create %q: %s", tt.desc, err)
73 }
74 } else if tt.err {
75 t.Fatalf("Did not get expected error for %q\n", tt.desc)
76 }
77 }
78}
79
80func TestMemoryGet(t *testing.T) {
81 var tests = []struct {

Callers

nothing calls this directly

Calls 5

tsFixtureMemoryFunction · 0.85
FatalfMethod · 0.80
releaseStubFunction · 0.70
testKeyFunction · 0.70
CreateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…