Skip to content

Commit

Permalink
#1 Change component target state to string type
Browse files Browse the repository at this point in the history
This was changed during the extraction and was most likely a mistake.
The original code used string here.
  • Loading branch information
ppxl committed Jan 20, 2025
1 parent fce42c3 commit 679e979
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions v2/blueprintV2/serializer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ func TestSerializeBlueprint_ok(t *testing.T) {
args{spec: BlueprintV2{
GeneralBlueprint: bpcore.GeneralBlueprint{API: bpcore.V2},
Components: []entities.TargetComponent{
{Name: "k8s/blueprint-operator", Version: v0211, TargetState: bpcore.TargetStatePresent},
{Name: "k8s/dogu-operator", Version: v2341, TargetState: bpcore.TargetStateAbsent, DeployConfig: map[string]interface{}{"deployNamespace": "ecosystem", "overwriteConfig": map[string]string{"key": "value"}}},
{Name: "k8s/blueprint-operator", Version: v0211, TargetState: bpcore.TargetStatePresent.String()},
{Name: "k8s/dogu-operator", Version: v2341, TargetState: bpcore.TargetStateAbsent.String(), DeployConfig: map[string]interface{}{"deployNamespace": "ecosystem", "overwriteConfig": map[string]string{"key": "value"}}},
},
}},
`{"blueprintApi":"v2","components":[{"name":"k8s/blueprint-operator","version":"0.2.1-1","targetState":"present"},{"name":"k8s/dogu-operator","version":"2.3.4-1","targetState":"absent","deployConfig":{"deployNamespace":"ecosystem","overwriteConfig":{"key":"value"}}}],"config":{"global":{}}}`,
Expand Down Expand Up @@ -194,8 +194,8 @@ func TestDeserializeBlueprint_ok(t *testing.T) {
BlueprintV2{
GeneralBlueprint: bpcore.GeneralBlueprint{API: bpcore.V2},
Components: []entities.TargetComponent{
{Name: "k8s/blueprint-operator", Version: v0211, TargetState: bpcore.TargetStatePresent},
{Name: "k8s/dogu-operator", Version: v2341, TargetState: bpcore.TargetStateAbsent},
{Name: "k8s/blueprint-operator", Version: v0211, TargetState: bpcore.TargetStatePresent.String()},
{Name: "k8s/dogu-operator", Version: v2341, TargetState: bpcore.TargetStateAbsent.String()},
},
},
assert.NoError,
Expand Down
4 changes: 1 addition & 3 deletions v2/entities/targetComponent.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package entities

import "github.com/cloudogu/blueprint-lib/bpcore"

type TargetComponent struct {
// Name defines the name of the component including its distribution namespace, f. i. "k8s/k8s-dogu-operator". Must not be empty.
Name string `json:"name"`
// Version defines the version of the component that is to be installed. Must not be empty if the targetState is "present";
// otherwise it is optional and is not going to be interpreted.
Version string `json:"version"`
// TargetState defines a state of installation of this component. Optional field, but defaults to "TargetStatePresent"
TargetState bpcore.TargetState `json:"targetState"`
TargetState string `json:"targetState"`
// DeployConfig defines a generic property map for the component configuration. This field is optional.
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:validation:Schemaless
Expand Down

0 comments on commit 679e979

Please sign in to comment.