Add brace bug test

Signed-off-by: colsen <colsen@adobe.com>
pull/13070/head
colsen 1 month ago
parent c412950492
commit 7606d0605e
No known key found for this signature in database
GPG Key ID: 141FFEF11F2D7405

@ -166,3 +166,21 @@ func TestValidateAgainstSchemaNegative(t *testing.T) {
t.Errorf("Error string :\n`%s`\ndoes not match expected\n`%s`", errString, expectedErrString)
}
}
func TestValidateAgainstBraceBug(t *testing.T) {
schemaJSON, err := os.ReadFile("./testdata/test-values-invalidBraceBug.schema.json")
if err != nil {
t.Fatalf("Error reading YAML file: %s", err)
}
values := map[string]interface{}{
"image": map[string]interface{}{
"repository": "nginx",
"pullPolicy": "Always",
},
}
if err := ValidateAgainstSingleSchema(values, schemaJSON); err == nil {
t.Error("The invalid schema should cause the validation to fail")
}
}

@ -0,0 +1,25 @@
{
"type": "object",
"required": [
"image"
],
"properties": {
"image": {
"type": "object",
"required": [
"repository",
"pullPolicy"
],
"properties": {
"repository": {
"type": "string",
"pattern": "^([-_/.a-z0-9]+)$"
},
"pullPolicy": {
"type": "string",
"pattern": "^(Always|Never|IfNotPresent)$"
}
}}
}
}
}
Loading…
Cancel
Save