client: Add an integration test for a bad blueprint depsolve

This test makes sure that a bad /blueprints/depsolve/... will return a
list of blueprints and a list of errors, not just a single error 400
response.
This commit is contained in:
Brian C. Lane 2020-07-27 13:54:56 -07:00 committed by Ondřej Budai
parent eb76b9ec8e
commit 7ca9579487

View file

@ -982,6 +982,31 @@ func TestDepsolveInvalidBlueprintV0(t *testing.T) {
require.Contains(t, api.Errors[0].Msg, "Invalid characters in API path")
}
// depsolve a blueprint with a depsolve that will fail
func TestBadDepsolveBlueprintV0(t *testing.T) {
if testState.unitTest {
t.Skip()
}
bp := `{
"name": "test-baddep-blueprint-v0",
"description": "TestBadDepsolveBlueprintV0",
"version": "0.0.1",
"packages": [{"name": "bash", "version": "*"}, {"name": "bad-package", "version": "1.32.1"}]
}`
// Push a blueprint
resp, err := PostJSONBlueprintV0(testState.socket, bp)
require.NoError(t, err, "POST blueprint failed with a client error")
require.True(t, resp.Status, "POST blueprint failed: %#v", resp)
// Depsolve the blueprint
deps, api, err := DepsolveBlueprintV0(testState.socket, "test-baddep-blueprint-v0")
require.NoError(t, err, "Depsolve blueprint failed with a client error")
require.Nil(t, api, "DepsolveBlueprint failed: %#v", api)
require.Greater(t, len(deps.Blueprints), 0, "No blueprints returned")
require.Greater(t, len(deps.Errors), 0, "Not enough errors returned")
}
// freeze a blueprint
func TestBlueprintFreezeV0(t *testing.T) {
if testState.unitTest {