Skip to content

Commit

Permalink
Extract values to const
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed Feb 11, 2022
1 parent 31d4f96 commit 291ef2c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/e2e/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ import (
)

const (
actionPassingPath = "cap.interface.capactio.capact.validation.action.passing"
actionPassingPath = "cap.interface.capactio.capact.validation.action.passing"
uploadTypePath = "cap.type.capactio.capact.validation.upload"
builtinStorageTypePath = "cap.core.type.hub.storage.neo4j"
singleKeyTypePath = "cap.type.capactio.capact.validation.single-key"
)

func getActionName() string {
Expand Down Expand Up @@ -329,7 +332,7 @@ func getActionFunc(ctx context.Context, cl *engine.Client, name string) func() (
func getTypeInstanceInputForPolicy() *hublocalgraphql.CreateTypeInstanceInput {
return &hublocalgraphql.CreateTypeInstanceInput{
TypeRef: &hublocalgraphql.TypeInstanceTypeReferenceInput{
Path: "cap.type.capactio.capact.validation.single-key",
Path: singleKeyTypePath,
Revision: "0.1.0",
},
Attributes: []*hublocalgraphql.AttributeReferenceInput{
Expand Down Expand Up @@ -488,7 +491,7 @@ func withHelmBackendForUploadTypeRef(backendID string) policyOption {
Rules: []*enginegraphql.RulesForTypeInstanceInput{
{
TypeRef: &enginegraphql.ManifestReferenceInput{
Path: "cap.type.capactio.capact.validation.upload",
Path: uploadTypePath,
Revision: ptr.String("0.1.0"),
},
Backend: &enginegraphql.TypeInstanceBackendRuleInput{
Expand Down Expand Up @@ -517,7 +520,7 @@ func prependInjectRuleForPassingActionInterface(reqInput []*enginegraphql.Requir
policy.Interface.Rules[idx].OneOf = append([]*enginegraphql.PolicyRuleInput{
{
ImplementationConstraints: &enginegraphql.PolicyRuleImplementationConstraintsInput{
Requires: manifestRef("cap.type.capactio.capact.validation.single-key"),
Requires: manifestRef(singleKeyTypePath),
Attributes: manifestRef("cap.attribute.capactio.capact.validation.policy.most-preferred"),
},
Inject: &enginegraphql.PolicyRuleInjectDataInput{
Expand Down Expand Up @@ -553,7 +556,7 @@ func getTypeInstanceByIDAndValue(ctx context.Context, hubClient *hubclient.Clien
func getUploadedTypeInstanceByValue(ctx context.Context, hubClient *hubclient.Client, expValue string) (*hublocalgraphql.TypeInstance, func()) {
uploaded, err := hubClient.ListTypeInstances(ctx, &hublocalgraphql.TypeInstanceFilter{
TypeRef: &hublocalgraphql.TypeRefFilterInput{
Path: "cap.type.capactio.capact.validation.upload",
Path: uploadTypePath,
Revision: ptr.String("0.1.0"),
},
})
Expand All @@ -572,7 +575,7 @@ func getUploadedTypeInstanceByValue(ctx context.Context, hubClient *hubclient.Cl
func getBuiltinStorageTypeInstance(ctx context.Context, hubClient *hubclient.Client) hublocalgraphql.TypeInstance {
coreStorage, err := hubClient.ListTypeInstances(ctx, &hublocalgraphql.TypeInstanceFilter{
TypeRef: &hublocalgraphql.TypeRefFilterInput{
Path: "cap.core.type.hub.storage.neo4j",
Path: builtinStorageTypePath,
Revision: ptr.String("0.1.0"),
},
})
Expand Down

0 comments on commit 291ef2c

Please sign in to comment.