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
587f020a
Unverified
Commit
587f020a
authored
Oct 31, 2018
by
k8s-ci-robot
Committed by
GitHub
Oct 31, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70368 from thomasem/cmd_test_to_cmd
Swap cmd_test to cmd package in kubeadm/app/cmd/config_test.go
parents
0be22d8a
f4a98e83
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
config_test.go
cmd/kubeadm/app/cmd/config_test.go
+12
-13
No files found.
cmd/kubeadm/app/cmd/config_test.go
View file @
587f020a
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
cmd
_test
package
cmd
import
(
"bytes"
...
...
@@ -31,7 +31,6 @@ import (
"github.com/spf13/cobra"
kubeadmapiv1beta1
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd"
"k8s.io/kubernetes/cmd/kubeadm/app/componentconfigs"
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/kubernetes/cmd/kubeadm/app/features"
...
...
@@ -52,7 +51,7 @@ const (
func
TestNewCmdConfigImagesList
(
t
*
testing
.
T
)
{
var
output
bytes
.
Buffer
mockK8sVersion
:=
dummyKubernetesVersion
images
:=
cmd
.
NewCmdConfigImagesList
(
&
output
,
&
mockK8sVersion
)
images
:=
NewCmdConfigImagesList
(
&
output
,
&
mockK8sVersion
)
images
.
Run
(
nil
,
nil
)
actual
:=
strings
.
Split
(
output
.
String
(),
"
\n
"
)
if
len
(
actual
)
!=
defaultNumberOfImages
{
...
...
@@ -109,7 +108,7 @@ func TestImagesListRunWithCustomConfigPath(t *testing.T) {
t
.
Fatalf
(
"Failed writing a config file: %v"
,
err
)
}
i
,
err
:=
cmd
.
NewImagesList
(
configFilePath
,
&
kubeadmapiv1beta1
.
InitConfiguration
{
i
,
err
:=
NewImagesList
(
configFilePath
,
&
kubeadmapiv1beta1
.
InitConfiguration
{
ClusterConfiguration
:
kubeadmapiv1beta1
.
ClusterConfiguration
{
KubernetesVersion
:
dummyKubernetesVersion
,
},
...
...
@@ -180,7 +179,7 @@ func TestConfigImagesListRunWithoutPath(t *testing.T) {
for
_
,
tc
:=
range
testcases
{
t
.
Run
(
tc
.
name
,
func
(
t
*
testing
.
T
)
{
i
,
err
:=
cmd
.
NewImagesList
(
""
,
&
tc
.
cfg
)
i
,
err
:=
NewImagesList
(
""
,
&
tc
.
cfg
)
if
err
!=
nil
{
t
.
Fatalf
(
"did not expect an error while creating the Images command: %v"
,
err
)
}
...
...
@@ -226,7 +225,7 @@ func TestImagesPull(t *testing.T) {
}
images
:=
[]
string
{
"a"
,
"b"
,
"c"
,
"d"
,
"a"
}
ip
:=
cmd
.
NewImagesPull
(
containerRuntime
,
images
)
ip
:=
NewImagesPull
(
containerRuntime
,
images
)
err
=
ip
.
PullAll
()
if
err
!=
nil
{
...
...
@@ -249,7 +248,7 @@ func TestMigrate(t *testing.T) {
defer
cleanup
()
var
output
bytes
.
Buffer
command
:=
cmd
.
NewCmdConfigMigrate
(
&
output
)
command
:=
NewCmdConfigMigrate
(
&
output
)
if
err
:=
command
.
Flags
()
.
Set
(
"old-config"
,
configFile
);
err
!=
nil
{
t
.
Fatalf
(
"failed to set old-config flag"
)
}
...
...
@@ -293,7 +292,7 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) {
constants
.
ClusterConfigurationKind
,
constants
.
InitConfigurationKind
,
},
cmdProc
:
cmd
.
NewCmdConfigPrintInitDefaults
,
cmdProc
:
NewCmdConfigPrintInitDefaults
,
},
{
name
:
"InitConfiguration: KubeProxyConfiguration"
,
...
...
@@ -303,7 +302,7 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) {
string
(
componentconfigs
.
KubeProxyConfigurationKind
),
},
componentConfigs
:
"KubeProxyConfiguration"
,
cmdProc
:
cmd
.
NewCmdConfigPrintInitDefaults
,
cmdProc
:
NewCmdConfigPrintInitDefaults
,
},
{
name
:
"InitConfiguration: KubeProxyConfiguration and KubeletConfiguration"
,
...
...
@@ -314,14 +313,14 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) {
string
(
componentconfigs
.
KubeletConfigurationKind
),
},
componentConfigs
:
"KubeProxyConfiguration,KubeletConfiguration"
,
cmdProc
:
cmd
.
NewCmdConfigPrintInitDefaults
,
cmdProc
:
NewCmdConfigPrintInitDefaults
,
},
{
name
:
"JoinConfiguration: No component configs"
,
expectedKinds
:
[]
string
{
constants
.
JoinConfigurationKind
,
},
cmdProc
:
cmd
.
NewCmdConfigPrintJoinDefaults
,
cmdProc
:
NewCmdConfigPrintJoinDefaults
,
},
{
name
:
"JoinConfiguration: KubeProxyConfiguration"
,
...
...
@@ -330,7 +329,7 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) {
string
(
componentconfigs
.
KubeProxyConfigurationKind
),
},
componentConfigs
:
"KubeProxyConfiguration"
,
cmdProc
:
cmd
.
NewCmdConfigPrintJoinDefaults
,
cmdProc
:
NewCmdConfigPrintJoinDefaults
,
},
{
name
:
"JoinConfiguration: KubeProxyConfiguration and KubeletConfiguration"
,
...
...
@@ -340,7 +339,7 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) {
string
(
componentconfigs
.
KubeletConfigurationKind
),
},
componentConfigs
:
"KubeProxyConfiguration,KubeletConfiguration"
,
cmdProc
:
cmd
.
NewCmdConfigPrintJoinDefaults
,
cmdProc
:
NewCmdConfigPrintJoinDefaults
,
},
}
...
...
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