ostree: include ref in error message when invalid
This commit is contained in:
parent
417d913439
commit
db345d75dd
2 changed files with 2 additions and 2 deletions
|
|
@ -61,7 +61,7 @@ func ResolveParams(params OSTreeRequest, imageType distro.ImageType) (OSTreeRequ
|
|||
if resolved.Ref == "" {
|
||||
resolved.Ref = imageType.OSTreeRef()
|
||||
} else if !VerifyRef(params.Ref) { // only verify if specified in params
|
||||
return resolved, fmt.Errorf("Invalid ostree ref")
|
||||
return resolved, fmt.Errorf("Invalid ostree ref %q", params.Ref)
|
||||
}
|
||||
|
||||
resolved.URL = params.URL
|
||||
|
|
|
|||
|
|
@ -821,7 +821,7 @@ func TestCompose(t *testing.T) {
|
|||
// Ref + invalid URL = error
|
||||
{false, "POST", "/api/v1/compose", fmt.Sprintf(`{"blueprint_name": "test","compose_type":"%s","branch":"master","ostree":{"ref":"refid","parent":"","url":"invalid-url"}}`, test_distro.TestImageTypeName), http.StatusBadRequest, `{"status":false,"errors":[{"id":"OSTreeOptionsError","msg":"Get \"invalid-url/refs/heads/refid\": unsupported protocol scheme \"\""}]}`, nil, []string{"build_id"}},
|
||||
// Bad Ref + URL = error
|
||||
{false, "POST", "/api/v1/compose", fmt.Sprintf(`{"blueprint_name": "test","compose_type":"%s","branch":"master","ostree":{"ref":"/bad/ref","parent":"","url":"http://ostree/"}}`, test_distro.TestImageTypeName), http.StatusBadRequest, `{"status":false,"errors":[{"id":"OSTreeOptionsError","msg":"Invalid ostree ref"}]}`, expectedComposeOSTreeURL, []string{"build_id"}},
|
||||
{false, "POST", "/api/v1/compose", fmt.Sprintf(`{"blueprint_name": "test","compose_type":"%s","branch":"master","ostree":{"ref":"/bad/ref","parent":"","url":"http://ostree/"}}`, test_distro.TestImageTypeName), http.StatusBadRequest, `{"status":false,"errors":[{"id":"OSTreeOptionsError","msg":"Invalid ostree ref \"/bad/ref\""}]}`, expectedComposeOSTreeURL, []string{"build_id"}},
|
||||
// Ref + Parent + URL = error
|
||||
{false, "POST", "/api/v1/compose", fmt.Sprintf(`{"blueprint_name": "test","compose_type":"%s","branch":"master","ostree":{"ref":"refid","parent":"parentid","url":"http://ostree/"}}`, test_distro.TestImageTypeName), http.StatusBadRequest, `{"status":false,"errors":[{"id":"OSTreeOptionsError","msg":"Supply at most one of Parent and URL"}]}`, expectedComposeOSTreeRef, []string{"build_id"}},
|
||||
// Parent + URL = error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue