Skip to content

Commit 546ef6e

Browse files
committed
review: strip trailing blank lines, modernize a test loop to slices.ContainsFunc
1 parent b3324ca commit 546ef6e

3 files changed

Lines changed: 2 additions & 9 deletions

File tree

k8s/admission/admission_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,3 @@ func TestServeRejectsMissingRequest(t *testing.T) {
9797
t.Errorf("handler should not be invoked when Request is nil")
9898
}
9999
}
100-

k8s/tls_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"net"
1212
"os"
1313
"path/filepath"
14+
"slices"
1415
"testing"
1516
"time"
1617
)
@@ -30,13 +31,7 @@ func TestGenerateSelfSignedCertIsParseable(t *testing.T) {
3031
if parsed.Subject.CommonName != "testhost" {
3132
t.Errorf("CN = %q", parsed.Subject.CommonName)
3233
}
33-
found := false
34-
for _, ip := range parsed.IPAddresses {
35-
if ip.String() == "10.0.0.1" {
36-
found = true
37-
}
38-
}
39-
if !found {
34+
if !slices.ContainsFunc(parsed.IPAddresses, func(ip net.IP) bool { return ip.String() == "10.0.0.1" }) {
4035
t.Errorf("SAN IP 10.0.0.1 missing from cert: %v", parsed.IPAddresses)
4136
}
4237
}

k8s/unstructured_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,3 @@ func TestDecodeUnstructured(t *testing.T) {
3030
t.Fatalf("decoded name mismatch: got %q", got.Spec.Name)
3131
}
3232
}
33-

0 commit comments

Comments
 (0)