-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11020 from lekaf974/bug/issue-10960-mesheryctl-pa…
…ttern-import-url Set source-type flag required
- Loading branch information
Showing
4 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "mesheryctl", | ||
"type": "client", | ||
"next_error_code": 1121 | ||
"next_error_code": 1122 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package pattern | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Test_importPattern_DisplayErrorsMissingFlags(t *testing.T) { | ||
type args struct { | ||
sourceType string | ||
file string | ||
patternURL string | ||
save bool | ||
} | ||
|
||
tests := []struct { | ||
name string | ||
args args | ||
want error | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "Import missing source type flag", | ||
args: args{"", "file.yaml", "", false}, | ||
want: ErrPatternSourceType(), | ||
wantErr: true, | ||
}, | ||
{ | ||
name: "Import missing file flag", | ||
args: args{"helm", "", "", false}, | ||
want: ErrPatternManifest(), | ||
wantErr: true, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
_, err := importPattern(tt.args.sourceType, tt.args.file, tt.args.patternURL, tt.args.save) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("importPattern() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
}) | ||
} | ||
} |