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