Merge pull request #111189 from Octopusjust/k8s-pr4

Add testcases for cmd/kubeadm/app/util/net.go and version.go
This commit is contained in:
Kubernetes Prow Robot 2022-07-18 02:49:27 -07:00 committed by GitHub
commit 5108b0a3a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -44,6 +44,12 @@ func TestGetHostname(t *testing.T) {
result: "overridden",
expectedErr: nil,
},
{
desc: "hostname contains spaces",
hostname: " OVERRIDDEN ",
result: "overridden",
expectedErr: nil,
},
{
desc: "hostname contains only spaces",
hostname: " ",

View File

@ -381,6 +381,11 @@ func TestKubeadmVersion(t *testing.T) {
input: "v1.9",
parsingError: true,
},
{
name: "invalid version with label and stray dot",
input: "v1.8.0-alpha.2.",
parsingError: true,
},
{
name: "invalid version with label and metadata",
input: "v1.8.0-alpha.2.1231+afabd012389d53a",