(t *testing.T)
| 32 | ) |
| 33 | |
| 34 | func TestKptGetSet(t *testing.T) { |
| 35 | type testCase struct { |
| 36 | name string |
| 37 | subdir string |
| 38 | tag string |
| 39 | branch string |
| 40 | setBy string |
| 41 | dataset string |
| 42 | replacements map[string][]string |
| 43 | |
| 44 | // the upstream doesn't have a kptfile |
| 45 | noKptfile bool |
| 46 | } |
| 47 | |
| 48 | tests := []testCase{ |
| 49 | {name: "subdir", subdir: "helloworld-set", |
| 50 | dataset: testutil.HelloWorldSet, |
| 51 | replacements: map[string][]string{ |
| 52 | "deploy.yaml": {"replicas: 5", "replicas: 7"}, |
| 53 | "Kptfile": { |
| 54 | ` setBy: package-default |
| 55 | value: "5"`, |
| 56 | ` value: "7" |
| 57 | isSet: true`, |
| 58 | }, |
| 59 | }, |
| 60 | }, |
| 61 | {name: "tag-subdir", tag: "v0.1.0", subdir: "helloworld-set", |
| 62 | dataset: testutil.HelloWorldSet, |
| 63 | replacements: map[string][]string{ |
| 64 | "deploy.yaml": {"replicas: 5", "replicas: 7"}, |
| 65 | "Kptfile": { |
| 66 | ` setBy: package-default |
| 67 | value: "5"`, |
| 68 | ` value: "7" |
| 69 | isSet: true`, |
| 70 | }, |
| 71 | }, |
| 72 | }, |
| 73 | {name: "tag", tag: "v0.1.0", dataset: testutil.HelloWorldSet, |
| 74 | replacements: map[string][]string{ |
| 75 | "deploy.yaml": {"replicas: 5", "replicas: 7"}, |
| 76 | "Kptfile": { |
| 77 | ` setBy: package-default |
| 78 | value: "5"`, |
| 79 | ` value: "7" |
| 80 | isSet: true`, |
| 81 | }, |
| 82 | }, |
| 83 | }, |
| 84 | {name: "branch", branch: "master", |
| 85 | dataset: testutil.HelloWorldSet, |
| 86 | replacements: map[string][]string{ |
| 87 | "deploy.yaml": {"replicas: 5", "replicas: 7"}, |
| 88 | "Kptfile": { |
| 89 | ` setBy: package-default |
| 90 | value: "5"`, |
| 91 | ` value: "7" |
nothing calls this directly
no test coverage detected