Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c360bac6
Unverified
Commit
c360bac6
authored
Mar 06, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #75032 from rosti/win-test
kubeadm: Don't hardcode temp path in a test
parents
0e2c2682
5a3b1a0c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
common_test.go
cmd/kubeadm/app/cmd/upgrade/common_test.go
+13
-7
No files found.
cmd/kubeadm/app/cmd/upgrade/common_test.go
View file @
c360bac6
...
@@ -18,11 +18,9 @@ package upgrade
...
@@ -18,11 +18,9 @@ package upgrade
import
(
import
(
"bytes"
"bytes"
"fmt"
"io/ioutil"
"io/ioutil"
"os"
"os"
"testing"
"testing"
"time"
kubeadmapi
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
kubeadmapi
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
)
)
...
@@ -77,17 +75,25 @@ func TestGetK8sVersionFromUserInput(t *testing.T) {
...
@@ -77,17 +75,25 @@ func TestGetK8sVersionFromUserInput(t *testing.T) {
name
:
"Version is optional"
,
name
:
"Version is optional"
,
},
},
}
}
for
tnum
,
tt
:=
range
tcases
{
for
_
,
tt
:=
range
tcases
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
flags
:=
&
applyPlanFlags
{}
flags
:=
&
applyPlanFlags
{}
if
len
(
tt
.
clusterConfig
)
>
0
{
if
len
(
tt
.
clusterConfig
)
>
0
{
tmpfile
:=
fmt
.
Sprintf
(
"/tmp/kubeadm-upgrade-common-test-%d-%d.yaml"
,
tnum
,
time
.
Now
()
.
Unix
()
)
file
,
err
:=
ioutil
.
TempFile
(
""
,
"kubeadm-upgrade-common-test-*.yaml"
)
if
err
:=
ioutil
.
WriteFile
(
tmpfile
,
[]
byte
(
tt
.
clusterConfig
),
0666
);
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to create test config file: %+v"
,
err
)
t
.
Fatalf
(
"Failed to create test config file: %+v"
,
err
)
}
}
defer
os
.
Remove
(
tmpfile
)
flags
.
cfgPath
=
tmpfile
tmpFileName
:=
file
.
Name
()
defer
os
.
Remove
(
tmpFileName
)
_
,
err
=
file
.
WriteString
(
tt
.
clusterConfig
)
file
.
Close
()
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to write test config file contents: %+v"
,
err
)
}
flags
.
cfgPath
=
tmpFileName
}
}
userVersion
,
err
:=
getK8sVersionFromUserInput
(
flags
,
tt
.
args
,
tt
.
isVersionMandatory
)
userVersion
,
err
:=
getK8sVersionFromUserInput
(
flags
,
tt
.
args
,
tt
.
isVersionMandatory
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment