feat: Update generated schema for provisionerd (#121)

This commit is contained in:
Kyle Carberry
2022-01-31 23:36:15 -06:00
committed by GitHub
parent bf90dede4f
commit ac617e1fa8
21 changed files with 1588 additions and 730 deletions

View File

@ -49,10 +49,14 @@ func TestParse(t *testing.T) {
}`,
},
Response: &proto.Parse_Response{
ParameterSchemas: []*proto.ParameterSchema{{
Name: "A",
Description: "Testing!",
}},
Type: &proto.Parse_Response_Complete{
Complete: &proto.Parse_Complete{
ParameterSchemas: []*proto.ParameterSchema{{
Name: "A",
Description: "Testing!",
}},
},
},
},
}, {
Name: "default-variable-value",
@ -62,17 +66,21 @@ func TestParse(t *testing.T) {
}`,
},
Response: &proto.Parse_Response{
ParameterSchemas: []*proto.ParameterSchema{{
Name: "A",
DefaultSource: &proto.ParameterSource{
Scheme: proto.ParameterSource_DATA,
Value: "\"wow\"",
Type: &proto.Parse_Response_Complete{
Complete: &proto.Parse_Complete{
ParameterSchemas: []*proto.ParameterSchema{{
Name: "A",
DefaultSource: &proto.ParameterSource{
Scheme: proto.ParameterSource_DATA,
Value: "\"wow\"",
},
DefaultDestination: &proto.ParameterDestination{
Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE,
Value: "A",
},
}},
},
DefaultDestination: &proto.ParameterDestination{
Scheme: proto.ParameterDestination_PROVISIONER_VARIABLE,
Value: "A",
},
}},
},
},
}, {
Name: "variable-validation",
@ -84,10 +92,15 @@ func TestParse(t *testing.T) {
}`,
},
Response: &proto.Parse_Response{
ParameterSchemas: []*proto.ParameterSchema{{
Name: "A",
ValidationCondition: `var.A == "value"`,
}},
Type: &proto.Parse_Response_Complete{
Complete: &proto.Parse_Complete{
ParameterSchemas: []*proto.ParameterSchema{{
Name: "A",
ValidationCondition: `var.A == "value"`,
},
},
},
},
},
}} {
testCase := testCase
@ -106,13 +119,23 @@ func TestParse(t *testing.T) {
})
require.NoError(t, err)
// Ensure the want and got are equivalent!
want, err := json.Marshal(testCase.Response)
require.NoError(t, err)
got, err := json.Marshal(response)
require.NoError(t, err)
for {
msg, err := response.Recv()
require.NoError(t, err)
require.Equal(t, string(want), string(got))
if msg.GetComplete() == nil {
continue
}
// Ensure the want and got are equivalent!
want, err := json.Marshal(testCase.Response)
require.NoError(t, err)
got, err := json.Marshal(msg)
require.NoError(t, err)
require.Equal(t, string(want), string(got))
break
}
})
}
}