Skip to content

Commit

Permalink
Update the bundle struct with the 'immutable' field from spec and upd…
Browse files Browse the repository at this point in the history
…ate the test

Signed-off-by: Jean-Christophe Sirot <[email protected]>
  • Loading branch information
Jean-Christophe Sirot committed Jul 17, 2019
1 parent 10de618 commit cbf59e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions bundle/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ func TestBundleMarshallAllThings(t *testing.T) {
Type: "string",
ContentEncoding: "base64",
},
"productKeyType": {
Type: "string",
},
},
Parameters: &ParametersDefinition{
Fields: map[string]ParameterDefinition{
Expand Down Expand Up @@ -468,6 +471,13 @@ func TestBundleMarshallAllThings(t *testing.T) {
EnvironmentVariable: "REPLICA_COUNT",
},
},
"productKey": {
Definition: "productKeyType",
Destination: &Location{
EnvironmentVariable: "PRODUCT_KEY",
},
Immutable: true,
},
},
Required: []string{"port", "host"},
},
Expand Down
1 change: 1 addition & 0 deletions bundle/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ type ParameterDefinition struct {
ApplyTo []string `json:"applyTo,omitempty" mapstructure:"applyTo,omitempty"`
Description string `json:"description,omitempty" mapstructure:"description"`
Destination *Location `json:"destination,omitemtpty" mapstructure:"destination"`
Immutable bool `json:"immutable,omitempty" mapstructure:"immutable,omitempty"`
}
2 changes: 1 addition & 1 deletion testdata/bundles/canonical-bundle.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"credentials":{"password":{"description":"a password","env":"PASSWORD","path":"/cnab/app/path"}},"definitions":{"clientCert":{"contentEncoding":"base64","type":"string"},"enabledType":{"default":false,"type":"boolean"},"hostType":{"default":"locahost.localdomain","type":"string"},"portType":{"default":1234,"type":"integer"},"replicaCountType":{"default":3,"type":"integer"}},"description":"something","images":{"server":{"description":"complicated","image":"nginx:1.0","imageType":"docker"}},"invocationImages":[{"image":"deislabs/invocation-image:1.0","imageType":"docker","labels":{"os":"Linux"}}],"name":"testBundle","outputs":{"fields":{"clientCert":{"definition":"clientCert","path":"/cnab/app/outputs/blah"}}},"parameters":{"fields":{"enabled":{"definition":"enabledType","destination":{"env":"ENABLED"}},"host":{"definition":"hostType","destination":{"env":"HOST"}},"port":{"definition":"portType","destination":{"env":"PORT"}},"replicaCount":{"definition":"replicaCountType","destination":{"env":"REPLICA_COUNT"}}},"required":["port","host"]},"schemaVersion":"v1.0.0-WD","version":"1.0"}
{"credentials":{"password":{"description":"a password","env":"PASSWORD","path":"/cnab/app/path"}},"definitions":{"clientCert":{"contentEncoding":"base64","type":"string"},"enabledType":{"default":false,"type":"boolean"},"hostType":{"default":"locahost.localdomain","type":"string"},"portType":{"default":1234,"type":"integer"},"productKeyType":{"type":"string"},"replicaCountType":{"default":3,"type":"integer"}},"description":"something","images":{"server":{"description":"complicated","image":"nginx:1.0","imageType":"docker"}},"invocationImages":[{"image":"deislabs/invocation-image:1.0","imageType":"docker","labels":{"os":"Linux"}}],"name":"testBundle","outputs":{"fields":{"clientCert":{"definition":"clientCert","path":"/cnab/app/outputs/blah"}}},"parameters":{"fields":{"enabled":{"definition":"enabledType","destination":{"env":"ENABLED"}},"host":{"definition":"hostType","destination":{"env":"HOST"}},"port":{"definition":"portType","destination":{"env":"PORT"}},"productKey":{"definition":"productKeyType","destination":{"env":"PRODUCT_KEY"},"immutable":true},"replicaCount":{"definition":"replicaCountType","destination":{"env":"REPLICA_COUNT"}}},"required":["port","host"]},"schemaVersion":"v1.0.0-WD","version":"1.0"}

0 comments on commit cbf59e4

Please sign in to comment.