testBuildLsFilesFormatImport does effectively an ls-files, but via doing a build of an Image, and then listing the files from the image as if --format=import was set.
(t *testing.T, expectedExitCode int, expectedFiles []string, buildArgs ...string)
| 4583 | // testBuildLsFilesFormatImport does effectively an ls-files, but via doing a build of an Image, and then |
| 4584 | // listing the files from the image as if --format=import was set. |
| 4585 | func testBuildLsFilesFormatImport(t *testing.T, expectedExitCode int, expectedFiles []string, buildArgs ...string) { |
| 4586 | buffer := bytes.NewBuffer(nil) |
| 4587 | testRun(t, expectedExitCode, nil, buffer, append([]string{"build", "-o", "-"}, buildArgs...)...) |
| 4588 | protoImage := &imagev1.Image{} |
| 4589 | err := protoencoding.NewWireUnmarshaler(nil).Unmarshal(buffer.Bytes(), protoImage) |
| 4590 | require.NoError(t, err) |
| 4591 | image, err := bufimage.NewImageForProto(protoImage) |
| 4592 | require.NoError(t, err) |
| 4593 | var paths []string |
| 4594 | for _, imageFile := range image.Files() { |
| 4595 | paths = append(paths, imageFile.Path()) |
| 4596 | } |
| 4597 | require.Equal(t, expectedFiles, paths) |
| 4598 | } |
| 4599 | |
| 4600 | func testModInit(t *testing.T, expectedData string, document bool, name string, deps ...string) { |
| 4601 | tempDir := t.TempDir() |
no test coverage detected
searching dependent graphs…