Test the order of file loading. The Chart.yaml file needs to come first for later comparison checks. See https://github.com/helm/helm/pull/8948
(t *testing.T)
| 267 | // Test the order of file loading. The Chart.yaml file needs to come first for |
| 268 | // later comparison checks. See https://github.com/helm/helm/pull/8948 |
| 269 | func TestLoadFilesOrder(t *testing.T) { |
| 270 | modTime := time.Now() |
| 271 | goodFiles := []*archive.BufferedFile{ |
| 272 | { |
| 273 | Name: "requirements.yaml", |
| 274 | ModTime: modTime, |
| 275 | Data: []byte("dependencies:"), |
| 276 | }, |
| 277 | { |
| 278 | Name: "values.yaml", |
| 279 | ModTime: modTime, |
| 280 | Data: []byte("var: some values"), |
| 281 | }, |
| 282 | |
| 283 | { |
| 284 | Name: "templates/deployment.yaml", |
| 285 | ModTime: modTime, |
| 286 | Data: []byte("some deployment"), |
| 287 | }, |
| 288 | { |
| 289 | Name: "templates/service.yaml", |
| 290 | ModTime: modTime, |
| 291 | Data: []byte("some service"), |
| 292 | }, |
| 293 | { |
| 294 | Name: "Chart.yaml", |
| 295 | ModTime: modTime, |
| 296 | Data: []byte(`apiVersion: v3 |
| 297 | name: frobnitz |
| 298 | description: This is a frobnitz. |
| 299 | version: "1.2.3" |
| 300 | keywords: |
| 301 | - frobnitz |
| 302 | - sprocket |
| 303 | - dodad |
| 304 | maintainers: |
| 305 | - name: The Helm Team |
| 306 | email: helm@example.com |
| 307 | - name: Someone Else |
| 308 | email: nobody@example.com |
| 309 | sources: |
| 310 | - https://example.com/foo/bar |
| 311 | home: http://example.com |
| 312 | icon: https://example.com/64x64.png |
| 313 | `), |
| 314 | }, |
| 315 | } |
| 316 | |
| 317 | // Capture stderr to make sure message about Chart.yaml handle dependencies |
| 318 | // is not present |
| 319 | r, w, err := os.Pipe() |
| 320 | if err != nil { |
| 321 | t.Fatalf("Unable to create pipe: %s", err) |
| 322 | } |
| 323 | stderr := log.Writer() |
| 324 | log.SetOutput(w) |
| 325 | defer func() { |
| 326 | log.SetOutput(stderr) |