-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update error msgs for OSImageURL validation:
As the error message is provided to Users, including the expected Kubernetes version format to the error message allows to User to clearly understand how to resolve the validation error. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
- Loading branch information
1 parent
57c91bc
commit 4abcacf
Showing
2 changed files
with
107 additions
and
6 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
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,33 @@ | ||
package tinkerbell | ||
|
||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
) | ||
|
||
func TestPermuatations(t *testing.T) { | ||
tests := []struct { | ||
initial string | ||
separators []string | ||
want string | ||
}{ | ||
{"125", []string{"-", "_", ""}, "125"}, | ||
{"1.26", []string{"-", "_", ""}, "1.26, 1-26, 1_26 or 126"}, | ||
{"1.27", []string{"."}, "1.27"}, | ||
{"1.28", []string{".", "."}, "1.28"}, | ||
{"1.29", []string{"-", "-", ""}, "1.29, 1-29 or 129"}, | ||
{"1.29.1", []string{"-", "_", "_", ""}, "1.29.1, 1-29-1, 1_29_1 or 1291"}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.initial, func(t *testing.T) { | ||
got := permutations(tt.initial, tt.separators) | ||
if diff := cmp.Diff(got, tt.want); diff != "" { | ||
t.Errorf("permutations() mismatch (-got +want):\n%s", diff) | ||
} | ||
}) | ||
} | ||
} | ||
|