Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix storage backend ID for TypeInstance from nested workflow #706

Merged
merged 3 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update renderer test for storage backends
  • Loading branch information
Mateusz Kuziemko committed Apr 27, 2022
commit 696150935ec62d3014809ead742285e7ce7b5047
3 changes: 2 additions & 1 deletion pkg/hub/client/fake/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ func (s *FileSystemClient) ListTypes(ctx context.Context, opts ...public.TypeOpt
Path: typeRev.Metadata.Path,
},
Spec: &hubpublicgraphql.TypeSpec{
JSONSchema: typeRev.Spec.JSONSchema,
JSONSchema: typeRev.Spec.JSONSchema,
AdditionalRefs: typeRev.Spec.AdditionalRefs,
},
}},
})
Expand Down
37 changes: 37 additions & 0 deletions pkg/sdk/renderer/argo/fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,43 @@ import (
"capact.io/capact/pkg/sdk/apis/0.0.1/types"
)

func fixHelmStorageGlobalPolicy() policy.Policy {
return policy.Policy{
Interface: policy.InterfacePolicy{
Default: &policy.InterfaceDefault{
Inject: &policy.DefaultInject{
RequiredTypeInstances: []policy.RequiredTypeInstanceToInject{
{
TypeInstanceReference: policy.TypeInstanceReference{
ID: "a35a0c04-6153-4fe9-8d49-9ec35a0e86e",
Description: ptr.String("Helm release"),
},
},
{
TypeInstanceReference: policy.TypeInstanceReference{
ID: "b1fcdf4c-f3e3-4b90-ba37-f8ca40c620e2",
Description: ptr.String("Helm template"),
},
},
},
},
},
Rules: policy.InterfaceRulesList{
{
Interface: types.ManifestRefWithOptRevision{
Path: "cap.*",
},
OneOf: []policy.Rule{
{
ImplementationConstraints: policy.ImplementationConstraints{},
},
},
},
},
},
}
}

func fixGCPGlobalPolicy() policy.Policy {
return policy.Policy{
Interface: policy.InterfacePolicy{
Expand Down
10 changes: 10 additions & 0 deletions pkg/sdk/renderer/argo/renderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@ func TestRenderHappyPathWithCustomPolicies(t *testing.T) {
userParameterCollection types.ParametersCollection
policy policy.Policy
}{
{
name: "Mattermost workflow with storage backends",
ref: types.InterfaceRef{
Path: "cap.interface.productivity.mattermost.install",
},
userParameterCollection: types.ParametersCollection{
"input-parameters": `{"host":"mattermost.local"}`,
},
policy: fixHelmStorageGlobalPolicy(),
},
{
name: "Mattermost with CloudSQL PostgreSQL installation with GCP SA injected",
ref: types.InterfaceRef{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ args:
name: inject-runner-context-step
template: inject-runner-context
- - arguments: {}
name: inject-input-type-instances-2-0-step
template: inject-input-type-instances-2-0
name: inject-input-type-instances-3-0-step
template: inject-input-type-instances-3-0
- - arguments: {}
name: populate-input-parameters-step
template: populate-input-parameters
Expand Down Expand Up @@ -258,7 +258,7 @@ args:
resources: {}
inputs: {}
metadata: {}
name: inject-input-type-instances-2-0
name: inject-input-type-instances-3-0
outputs:
artifacts:
- globalName: gcp-sa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ args:
name: rds-instance
steps:
- - arguments: {}
name: inject-input-type-instances-5-0-step
template: inject-input-type-instances-5-0
name: inject-input-type-instances-6-0-step
template: inject-input-type-instances-6-0
- - arguments:
artifacts:
- from: '{{inputs.artifacts.input-parameters}}'
Expand Down Expand Up @@ -869,7 +869,7 @@ args:
resources: {}
inputs: {}
metadata: {}
name: inject-input-type-instances-5-0
name: inject-input-type-instances-6-0
outputs:
artifacts:
- globalName: aws-credentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ args:
name: postgresql
steps:
- - arguments: {}
name: inject-input-type-instances-0-0-step
template: inject-input-type-instances-0-0
name: inject-input-type-instances-1-0-step
template: inject-input-type-instances-1-0
- - arguments:
artifacts:
- from: '{{inputs.artifacts.input-parameters}}'
Expand Down Expand Up @@ -592,7 +592,7 @@ args:
resources: {}
inputs: {}
metadata: {}
name: inject-input-type-instances-0-0
name: inject-input-type-instances-1-0
outputs:
artifacts:
- globalName: gcp-sa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ args:
name: postgresql
steps:
- - arguments: {}
name: inject-input-type-instances-4-0-step
template: inject-input-type-instances-4-0
name: inject-input-type-instances-5-0-step
template: inject-input-type-instances-5-0
- - arguments:
artifacts:
- from: '{{inputs.artifacts.input-parameters}}'
Expand Down Expand Up @@ -653,7 +653,7 @@ args:
resources: {}
inputs: {}
metadata: {}
name: inject-input-type-instances-4-0
name: inject-input-type-instances-5-0
outputs:
artifacts:
- globalName: gcp-sa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -950,14 +950,14 @@ args:
outputs: {}
steps:
- - arguments: {}
name: inject-input-type-instances-1-1-step
template: inject-input-type-instances-1-1
name: inject-input-type-instances-2-1-step
template: inject-input-type-instances-2-1
- - arguments: {}
name: inject-runner-context-step
template: inject-runner-context
- - arguments: {}
name: inject-input-type-instances-1-0-step
template: inject-input-type-instances-1-0
name: inject-input-type-instances-2-0-step
template: inject-input-type-instances-2-0
- - arguments: {}
name: populate-input-parameters-step
template: populate-input-parameters
Expand Down Expand Up @@ -1072,7 +1072,7 @@ args:
resources: {}
inputs: {}
metadata: {}
name: inject-input-type-instances-1-0
name: inject-input-type-instances-2-0
outputs:
artifacts:
- globalName: postgresql
Expand Down Expand Up @@ -1122,7 +1122,7 @@ args:
resources: {}
inputs: {}
metadata: {}
name: inject-input-type-instances-1-1
name: inject-input-type-instances-2-1
outputs:
artifacts:
- globalName: postgresql
Expand Down
Loading