fix(ske): prevent usage of UUID for dns extension (#1025)

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
This commit is contained in:
Alexander Dahmen 2025-10-10 14:24:29 +02:00 committed by GitHub
parent 55a9a430fc
commit 3769b43527
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 65 additions and 0 deletions

View file

@ -55,6 +55,50 @@ func TestUUID(t *testing.T) {
}
}
func TestNoUUID(t *testing.T) {
tests := []struct {
description string
input string
isValid bool
}{
{
"UUID",
"cae27bba-c43d-498a-861e-d11d241c4ff8",
false,
},
{
"no UUID",
"a-b-c-d",
true,
},
{
"Empty",
"",
true,
},
{
"domain name",
"www.test.de",
true,
},
}
for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
r := validator.StringResponse{}
NoUUID().ValidateString(context.Background(), validator.StringRequest{
ConfigValue: types.StringValue(tt.input),
}, &r)
if !tt.isValid && !r.Diagnostics.HasError() {
t.Fatalf("Should have failed")
}
if tt.isValid && r.Diagnostics.HasError() {
t.Fatalf("Should not have failed: %v", r.Diagnostics.Errors())
}
})
}
}
func TestIP(t *testing.T) {
tests := []struct {
description string