...
1
16
17 package releaseutil
18
19 import (
20 "reflect"
21 "testing"
22 )
23
24 const mockManifestFile = `
25
26 ---
27 apiVersion: v1
28 kind: Pod
29 metadata:
30 name: finding-nemo,
31 annotations:
32 "helm.sh/hook": test
33 spec:
34 containers:
35 - name: nemo-test
36 image: fake-image
37 cmd: fake-command
38 `
39
40 const expectedManifest = `apiVersion: v1
41 kind: Pod
42 metadata:
43 name: finding-nemo,
44 annotations:
45 "helm.sh/hook": test
46 spec:
47 containers:
48 - name: nemo-test
49 image: fake-image
50 cmd: fake-command`
51
52 func TestSplitManifest(t *testing.T) {
53 manifests := SplitManifests(mockManifestFile)
54 if len(manifests) != 1 {
55 t.Errorf("Expected 1 manifest, got %v", len(manifests))
56 }
57 expected := map[string]string{"manifest-0": expectedManifest}
58 if !reflect.DeepEqual(manifests, expected) {
59 t.Errorf("Expected %v, got %v", expected, manifests)
60 }
61 }
62
View as plain text