Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
dmjb committed Mar 19, 2024
1 parent ac4df07 commit 4342ae8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/controlplane/handlers_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func TestCreateProfile(t *testing.T) {
Name: "colon:invalid",
},
},
wantErr: `Couldn't create profile: validation failed: profile names may only contain letters, numbers, hyphens and underscores`,
wantErr: `Couldn't create profile: validation failed: name may only contain letters, numbers, hyphens and underscores`,
}, {
name: "Create profile with no rules",
profile: &minderv1.CreateProfileRequest{
Expand Down
4 changes: 3 additions & 1 deletion internal/marketplace/namespaces/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ func ValidateNamespacedNameRules(name string, subscriptionID uuid.UUID) error {
} else if !hasNamespace && subscriptionID != uuid.Nil {
return errors.New("rule types and profiles from subscriptions must have namespaced names")
}
// TODO: validate that it is the correct namespace

// in future, we may want to check that the namespace in the profile/rule
// name is the same as the one in the subscription bundle
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/api/protobuf/go/minder/v1/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (rt *RuleType) Validate() error {
}

if err := validateNamespacedName(rt.GetName()); err != nil {
return fmt.Errorf("%w: invalid rule type name: %w", ErrInvalidRuleType, err)
return fmt.Errorf("%w: %w", ErrInvalidRuleType, err)
}

if rt.Def == nil {
Expand Down Expand Up @@ -195,7 +195,7 @@ func (p *Profile) Validate() error {
}

if err := validateNamespacedName(p.GetName()); err != nil {
return fmt.Errorf("%w: invalid rule type name: %w", ErrInvalidRuleType, err)
return fmt.Errorf("%w: %w", ErrValidationFailed, err)
}

repoRuleCount := len(p.GetRepository())
Expand Down

0 comments on commit 4342ae8

Please sign in to comment.