Skip to content

Commit

Permalink
bake: test empty attribute
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Dec 2, 2024
1 parent 4579570 commit 6b365ea
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bake/bake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,26 @@ target "app" {
})
}

// https://github.com/docker/buildx/pull/428
// https://github.com/docker/buildx/issues/2822
func TestEmptyAttribute(t *testing.T) {
fp := File{
Name: "docker-bake.hcl",
Data: []byte(`
target "app" {
output = [""]
}
`),
}

ctx := context.TODO()

m, _, err := ReadTargets(ctx, []File{fp}, []string{"app"}, nil, nil)
require.Equal(t, 1, len(m))
require.Len(t, m["app"].Outputs, 0)

Check failure on line 2038 in bake/bake_test.go

View workflow job for this annotation

GitHub Actions / test-unit (ubuntu-24.04)

Failed: bake/TestEmptyAttribute

=== RUN TestEmptyAttribute bake_test.go:2038: Error Trace: /home/runner/work/buildx/buildx/bake/bake_test.go:2038 Error: "[]" should have 0 item(s), but has 1 Test: TestEmptyAttribute --- FAIL: TestEmptyAttribute (0.00s)

Check failure on line 2038 in bake/bake_test.go

View workflow job for this annotation

GitHub Actions / test-unit (macos-14)

Failed: bake/TestEmptyAttribute

=== RUN TestEmptyAttribute bake_test.go:2038: Error Trace: /Users/runner/work/buildx/buildx/bake/bake_test.go:2038 Error: "[]" should have 0 item(s), but has 1 Test: TestEmptyAttribute --- FAIL: TestEmptyAttribute (0.00s)

Check failure on line 2038 in bake/bake_test.go

View workflow job for this annotation

GitHub Actions / test-unit (windows-2022)

Failed: bake/TestEmptyAttribute

=== RUN TestEmptyAttribute bake_test.go:2038: Error Trace: D:/a/buildx/buildx/bake/bake_test.go:2038 Error: "[]" should have 0 item(s), but has 1 Test: TestEmptyAttribute --- FAIL: TestEmptyAttribute (0.00s)
require.NoError(t, err)
}

func stringify[V fmt.Stringer](values []V) []string {
s := make([]string, len(values))
for i, v := range values {
Expand Down

0 comments on commit 6b365ea

Please sign in to comment.