Skip to content

Commit d67e6fb

Browse files
committed
refactor: use util validation instead of hard coded regexp
1 parent 508b500 commit d67e6fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/v1alpha1/metalstackcluster_types_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
. "github.com/onsi/ginkgo/v2"
66
. "github.com/onsi/gomega"
77
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8+
utilvalidation "k8s.io/apimachinery/pkg/util/validation"
89
)
910

1011
var _ = Describe("MetalStackCluster", func() {
@@ -17,8 +18,7 @@ var _ = Describe("MetalStackCluster", func() {
1718
}
1819

1920
clusterID := cluster.GetClusterID()
20-
// We extracted this regexp from an error message when trying to set a wrong label
21-
Expect(clusterID).To(MatchRegexp("^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$"))
21+
Expect(utilvalidation.IsValidLabelValue(clusterID)).To(BeEmpty())
2222
})
2323

2424
It("GetClusterID is constant", func() {

0 commit comments

Comments
 (0)