-
Notifications
You must be signed in to change notification settings - Fork 0
Make cluster type overwritable #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
844328f
Remove unused code
2e2b206
Make cluster type overwritable, e.g. for testing purposes
0dadc8c
ClusterType Tests
a33d6b8
Prettier cluster names
c15b929
Merge branch 'main' into mc/cluster-type-overwritable
mclasmeier b2dd002
Make ClusterType a string wrapper
881da7f
Merge remote-tracking branch 'origin/mc/cluster-type-overwritable' in…
015dc4a
linter
01f62c8
Make cluster type overwritable, e.g. for testing purposes
a70bc7a
ClusterType Tests
4c32329
Prettier cluster names
1171b6e
Make ClusterType a string wrapper
f9ce245
linter
7e75a71
Update cmd/deploy.go
mclasmeier 6685fa6
Merge remote-tracking branch 'origin/mc/cluster-type-overwritable' in…
74164de
Rename function: GetCurrentClusterType -> GetAutoDetectedClusterType
8307b55
Update cmd/deploy.go
mclasmeier 87ba2cd
New ClusterType method: NeedsPullSecrets
ba47e53
Simplify ClusterType String() implementation
8d06f3c
Make ClusterTypeUnknown be backed by empty string
9c94024
Merge remote-tracking branch 'refs/remotes/origin/mc/cluster-type-ove…
2fcc87f
Test case for ClusterTypeUnknown unmarshaling
9288ca3
Merge branch 'main' into mc/cluster-type-overwritable
mclasmeier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,74 @@ | ||
| package types | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| "gopkg.in/yaml.v3" | ||
| ) | ||
|
|
||
| func TestClusterTypeMarshalYAML(t *testing.T) { | ||
| tests := []struct { | ||
| clusterType ClusterType | ||
| expected string | ||
| }{ | ||
| {ClusterTypeInfraGKE, "InfraGKE"}, | ||
| {ClusterTypeInfraOpenShift4, "InfraOpenShift4"}, | ||
| {ClusterTypeOpenShift4, "OpenShift4"}, | ||
| {ClusterTypeKind, "Kind"}, | ||
| {ClusterTypeMinikube, "Minikube"}, | ||
| {ClusterTypeK3s, "K3s"}, | ||
| {ClusterTypeCRC, "CRC"}, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.expected, func(t *testing.T) { | ||
| out, err := yaml.Marshal(tt.clusterType) | ||
| require.NoError(t, err) | ||
| assert.Equal(t, tt.expected+"\n", string(out)) | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestClusterTypeUnmarshalYAML(t *testing.T) { | ||
| tests := []struct { | ||
| input string | ||
| expected ClusterType | ||
| }{ | ||
| {"InfraGKE", ClusterTypeInfraGKE}, | ||
| {"InfraOpenShift4", ClusterTypeInfraOpenShift4}, | ||
| {"OpenShift4", ClusterTypeOpenShift4}, | ||
| {"Kind", ClusterTypeKind}, | ||
| {"Minikube", ClusterTypeMinikube}, | ||
| {"K3s", ClusterTypeK3s}, | ||
| {"CRC", ClusterTypeCRC}, | ||
| {"", ClusterTypeUnknown}, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.input, func(t *testing.T) { | ||
| var ct ClusterType | ||
| err := yaml.Unmarshal([]byte(tt.input), &ct) | ||
| require.NoError(t, err) | ||
| assert.Equal(t, tt.expected, ct) | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestClusterTypeUnmarshalYAML_Invalid(t *testing.T) { | ||
| var ct ClusterType | ||
| err := yaml.Unmarshal([]byte("bogus"), &ct) | ||
| assert.ErrorContains(t, err, "unknown cluster type identifier") | ||
| } | ||
|
|
||
| func TestClusterTypeRoundTrip(t *testing.T) { | ||
| for _, ct := range AllClusterTypes() { | ||
| t.Run(ct.String(), func(t *testing.T) { | ||
| out, err := yaml.Marshal(ct) | ||
| require.NoError(t, err) | ||
|
|
||
| var parsed ClusterType | ||
| require.NoError(t, yaml.Unmarshal(out, &parsed)) | ||
| assert.Equal(t, ct, parsed) | ||
| }) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.