mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
feat: Update generated schema for provisionerd (#121)
This commit is contained in:
@ -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
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user