forked from kubernetes/minikube
-
Notifications
You must be signed in to change notification settings - Fork 0
[minikube]:windows node setup #4
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
Open
bobsira
wants to merge
22
commits into
feature/windows-node-support
Choose a base branch
from
user/bosira/windows-node-initialization
base: feature/windows-node-support
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6679186
Extend minikube start command to accept windows os version flag (#1)
bobsira c2b2daa
Merge branch 'kubernetes:master' into feature/windows-node-support
bobsira d2afbfa
Merge branch 'kubernetes:master' into feature/windows-node-support
bobsira bad9f03
Download and cache windows server ISO to preloads folder (#3)
bobsira 9883a43
Merge branch 'kubernetes:master' into feature/windows-node-support
bobsira 54cd55c
Extended minikube node add command to accept flags for adding a windo…
bobsira 08a4ee6
windows node init setup
bobsira df3e08a
logic for windows node initialization
bobsira f6ff78c
efforts to reduce node join command time
bobsira 83dc84f
logic for only server 2025
bobsira 3991998
short-circuit for minikube delete for windows
bobsira 293f56c
ssh authnetication refactor
bobsira 4ebe11c
reverted Download and cache windows server ISO to preloads folder PR …
bobsira 26f42a4
modified the tests for NewHost
bobsira 361c0b3
node-os flag implementation
bobsira 4b4c79d
node-os shorthand is more than one ASCII character panic fix
bobsira b5ef9b0
user personalized server vhd logic
bobsira 2005871
fixed failing tests
bobsira 71e7730
attempts to fix trySigKillProcess test
bobsira 3489fbf
reverting test changes
bobsira 0c7fc2e
Merge feature/windows-node-support into user/bosira/windows-node-init…
bobsira 3d4c149
Ported over machine-minikube Windows node changes
bobsira 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| /* | ||
| Copyright 2024 The Kubernetes Authors All rights reserved. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package cmd | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/pkg/errors" | ||
| ) | ||
|
|
||
| func TestValidateOS(t *testing.T) { | ||
| tests := []struct { | ||
| osType string | ||
| errorMsg string | ||
| }{ | ||
| {"linux", ""}, | ||
| {"windows", ""}, | ||
| {"foo", "Invalid OS: foo. Valid OS are: linux, windows"}, | ||
| } | ||
| for _, test := range tests { | ||
| t.Run(test.osType, func(t *testing.T) { | ||
| got := validateOS(test.osType) | ||
| gotError := "" | ||
| if got != nil { | ||
| gotError = got.Error() | ||
| } | ||
| if gotError != test.errorMsg { | ||
| t.Errorf("validateOS(osType=%v): got %v, expected %v", test.osType, got, test.errorMsg) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| // TestParseOSFlag is the main test function for parseOSFlag | ||
| func TestParseOSFlag(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| input string | ||
| expectedOS string | ||
| expectedVer string | ||
| expectedErr error | ||
| }{ | ||
| { | ||
| name: "Valid input with all fields", | ||
| input: "os=windows,version=2019", | ||
| expectedOS: "windows", | ||
| expectedVer: "2019", | ||
| expectedErr: nil, | ||
| }, | ||
| { | ||
| name: "Valid input with default version for windows", | ||
| input: "os=windows", | ||
| expectedOS: "windows", | ||
| expectedVer: "2022", | ||
| expectedErr: nil, | ||
| }, | ||
| { | ||
| name: "Valid input with linux and no version", | ||
| input: "os=linux", | ||
| expectedOS: "linux", | ||
| expectedVer: "", | ||
| expectedErr: nil, | ||
| }, | ||
| { | ||
| name: "Invalid input with missing version", | ||
| input: "os=linux,version=", | ||
| expectedOS: "linux", | ||
| expectedVer: "", | ||
| expectedErr: nil, | ||
| }, | ||
| { | ||
| name: "Invalid input with extra comma", | ||
| input: "os=linux,version=,", | ||
| expectedOS: "", | ||
| expectedVer: "", | ||
| expectedErr: errors.New("Invalid format for --os flag: os=linux,version=,"), | ||
| }, | ||
| { | ||
| name: "Invalid input with no key-value pair", | ||
| input: "linux,version=2022", | ||
| expectedOS: "", | ||
| expectedVer: "", | ||
| expectedErr: errors.New("Invalid format for --os flag: linux,version=2022"), | ||
| }, | ||
| { | ||
| name: "Valid input with extra spaces", | ||
| input: "os=linux , version=latest", | ||
| expectedOS: "linux", | ||
| expectedVer: "", | ||
| expectedErr: nil, | ||
| }, | ||
| { | ||
| name: "Valid input with capital letters in keys", | ||
| input: "OS=linux,Version=2022", | ||
| expectedOS: "linux", | ||
| expectedVer: "", | ||
| expectedErr: nil, | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| gotOS, gotVer, err := parseOSFlag(tt.input) | ||
|
|
||
| if tt.expectedErr != nil && (err == nil || err.Error() != tt.expectedErr.Error()) { | ||
| t.Errorf("Expected error %v, got %v", tt.expectedErr, err) | ||
| } else if tt.expectedErr == nil && err != nil { | ||
| t.Errorf("Expected no error, but got %v", err) | ||
| } | ||
|
|
||
| if gotOS != tt.expectedOS { | ||
| t.Errorf("Expected OS %s, got %s", tt.expectedOS, gotOS) | ||
| } | ||
|
|
||
| if gotVer != tt.expectedVer { | ||
| t.Errorf("Expected version %s, got %s", tt.expectedVer, gotVer) | ||
| } | ||
| }) | ||
| } | ||
| } |
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
Oops, something went wrong.
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.