(test string, t *testing.T)
| 219 | } |
| 220 | |
| 221 | func runTest(test string, t *testing.T) { |
| 222 | |
| 223 | // There should be 3 files for each test, for example: |
| 224 | // bucket-module.yaml, bucket-template.yaml, bucket-expect.yaml |
| 225 | |
| 226 | path := fmt.Sprintf("./tmpl/%v-expect.yaml", test) |
| 227 | |
| 228 | expectedTemplate, err := parse.File(path) |
| 229 | if err != nil { |
| 230 | t.Errorf("expected %s: %v", test, err) |
| 231 | return |
| 232 | } |
| 233 | |
| 234 | pkg.Experimental = true |
| 235 | |
| 236 | packaged, err := pkg.File(fmt.Sprintf("./tmpl/%v-template.yaml", test)) |
| 237 | if err != nil { |
| 238 | t.Errorf("packaged %s: %v", test, err) |
| 239 | return |
| 240 | } |
| 241 | |
| 242 | //y := format.String(packaged, format.Options{ |
| 243 | // JSON: false, |
| 244 | // Unsorted: false, |
| 245 | //}) |
| 246 | |
| 247 | d := diff.New(packaged, expectedTemplate) |
| 248 | if d.Mode() != "=" { |
| 249 | t.Errorf("Module test %s failed: %v", test, d.Format(true)) |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | // runFailTest should fail to package |
| 254 | func runFailTest(test string, t *testing.T) { |
no test coverage detected