Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Mauren <698465+stormqueen1990@users.noreply.github.com>
  • Loading branch information
kozjan and stormqueen1990 committed May 21, 2024
1 parent effbe6b commit c85ee43
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion kustomize/commands/edit/add/addmetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (o *addMetadataOptions) validateAndParse(args []string) error {
if len(args) < 1 {
return fmt.Errorf("must specify %s", o.kind)
}
if o.labelsWithoutSelector == false && o.includeTemplates == true {
if !o.labelsWithoutSelector && o.includeTemplates {
return fmt.Errorf("--without-selector flag must be specified for --include-templates to work")
}
m, err := util.ConvertSliceToMap(args, o.kind.String())
Expand Down
4 changes: 1 addition & 3 deletions kustomize/commands/edit/add/addmetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,7 @@ func TestAddLabelIncludeTemplatesWithoutRequiredFlag(t *testing.T) {
err := cmd.RunE(cmd, args)
v.VerifyNoCall()
require.Error(t, err)
if err.Error() != "--without-selector flag must be specified for --include-templates to work" {
t.Errorf("incorrect error: %v", err.Error())
}
require.Containsf(t, err.Error(), "--without-selector flag must be specified for --include-templates to work", "incorrect error: %s", err.Error())
}

func TestAddLabelWithoutSelectorAddLabel(t *testing.T) {
Expand Down

0 comments on commit c85ee43

Please sign in to comment.