(t *testing.T)
| 146 | } |
| 147 | |
| 148 | func Test_determineInputSpec(t *testing.T) { |
| 149 | cases := []struct { |
| 150 | name string |
| 151 | arguments data |
| 152 | spec *app.SnapshotSpec |
| 153 | err string |
| 154 | }{ |
| 155 | { |
| 156 | name: "imageRef", |
| 157 | arguments: data{ |
| 158 | imageRef: "registry/image:tag", |
| 159 | }, |
| 160 | spec: &app.SnapshotSpec{ |
| 161 | Components: []app.SnapshotComponent{ |
| 162 | { |
| 163 | Name: "Unnamed", |
| 164 | ContainerImage: "registry/image:tag", |
| 165 | }, |
| 166 | }, |
| 167 | }, |
| 168 | }, |
| 169 | { |
| 170 | name: "empty ApplicationSnapshot string", |
| 171 | arguments: data{ |
| 172 | input: "{}", |
| 173 | }, |
| 174 | spec: &app.SnapshotSpec{}, |
| 175 | }, |
| 176 | { |
| 177 | name: "faulty ApplicationSnapshot string", |
| 178 | arguments: data{ |
| 179 | input: "{", |
| 180 | }, |
| 181 | err: "unable to parse Snapshot specification from {: error converting YAML to JSON: yaml: line 1: did not find expected node content", |
| 182 | }, |
| 183 | { |
| 184 | name: "ApplicationSnapshot JSON string - images", |
| 185 | arguments: data{ |
| 186 | images: `{ |
| 187 | "components": [ |
| 188 | { |
| 189 | "name": "nodejs", |
| 190 | "containerImage": "quay.io/hacbs-contract-demo/single-nodejs-app:877418e" |
| 191 | } |
| 192 | ] |
| 193 | }`, |
| 194 | }, |
| 195 | spec: &app.SnapshotSpec{ |
| 196 | Application: "", |
| 197 | Components: []app.SnapshotComponent{ |
| 198 | { |
| 199 | Name: "nodejs", |
| 200 | ContainerImage: "quay.io/hacbs-contract-demo/single-nodejs-app:877418e", |
| 201 | }, |
| 202 | }, |
| 203 | }, |
| 204 | }, |
| 205 | { |
nothing calls this directly
no test coverage detected