Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.approval_tests_temp
approvals/*.received.txt
1 change: 1 addition & 0 deletions approvals/kir_test.TestError.Service.stderr.approved.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error processing document: unsupported kind Service
16 changes: 13 additions & 3 deletions approvals/kir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func TestKind(t *testing.T) {
}

func TestError(t *testing.T) {
t.Parallel()

cases := []struct {
name string
Expand All @@ -72,10 +73,19 @@ func TestError(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
images, err := processor.ProcessFile(tc.file)
if err == nil {
t.Fatalf("ProcessFile() error = %v", err)
t.Fatalf("ProcessFile() expected error but got nil")
}
imagesAsString := strings.Join(images, "\n")
approvals.VerifyString(t, imagesAsString)

// Test stdout output
stdoutOutput := ""
if len(images) > 0 {
stdoutOutput = strings.Join(images, "\n")
}
approvals.VerifyString(t, stdoutOutput, approvals.Options().ForFile().WithAdditionalInformation("stdout"))

// Test stderr output
stderrOutput := err.Error()
approvals.VerifyString(t, stderrOutput, approvals.Options().ForFile().WithAdditionalInformation("stderr"))
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/mpv/kir
go 1.24.1

require (
github.com/approvals/go-approval-tests v1.2.0
github.com/approvals/go-approval-tests v1.5.0
k8s.io/api v0.32.3
k8s.io/apimachinery v0.32.3
k8s.io/client-go v0.32.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/approvals/go-approval-tests v1.2.0 h1:0gnbtkFLryEa7ojI6YSP5SeBHOfYHCWFnOTM8q9BQz4=
github.com/approvals/go-approval-tests v1.2.0/go.mod h1:Jw45q7bEifPpUkRU2S5GCthnwDxMUWPHTGcNewVh6mw=
github.com/approvals/go-approval-tests v1.5.0 h1:4t8BL8xwrsR2BNhHIZHBmf43SYmkSmkPBPtCqUNOBMA=
github.com/approvals/go-approval-tests v1.5.0/go.mod h1:i7AlHlLqLyxTby+MnSFgxkObjFlsywI46fnOitjMBiU=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down