Merge pull request #96761 from ingvagabund/kubectl-explicit-test-namespace
kubectl/pkg/cmd tests: set explicit namespace Kubernetes-commit: d8fbc523c1d1c6629669da99cd271d81f1b0e641
This commit is contained in:
commit
3d80b9f024
|
@ -924,7 +924,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api",
|
||||
"Rev": "d10e393578ca"
|
||||
"Rev": "fcac651617f2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery",
|
||||
|
@ -936,7 +936,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go",
|
||||
"Rev": "fb61a7c88cb9"
|
||||
"Rev": "50c086135a49"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/code-generator",
|
||||
|
|
8
go.mod
8
go.mod
|
@ -34,10 +34,10 @@ require (
|
|||
github.com/stretchr/testify v1.6.1
|
||||
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd
|
||||
gopkg.in/yaml.v2 v2.2.8
|
||||
k8s.io/api v0.0.0-20201209045732-d10e393578ca
|
||||
k8s.io/api v0.0.0-20201209045733-fcac651617f2
|
||||
k8s.io/apimachinery v0.0.0-20201209005534-8f01ffc4dcb8
|
||||
k8s.io/cli-runtime v0.0.0-20201114091436-bb334014705f
|
||||
k8s.io/client-go v0.0.0-20201121005859-fb61a7c88cb9
|
||||
k8s.io/client-go v0.0.0-20201209050020-50c086135a49
|
||||
k8s.io/component-base v0.0.0-20201114090208-1e84b325f5ba
|
||||
k8s.io/component-helpers v0.0.0-20201114090304-7cb42b694587
|
||||
k8s.io/klog/v2 v2.4.0
|
||||
|
@ -49,10 +49,10 @@ require (
|
|||
)
|
||||
|
||||
replace (
|
||||
k8s.io/api => k8s.io/api v0.0.0-20201209045732-d10e393578ca
|
||||
k8s.io/api => k8s.io/api v0.0.0-20201209045733-fcac651617f2
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20201209005534-8f01ffc4dcb8
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20201114091436-bb334014705f
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20201121005859-fb61a7c88cb9
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20201209050020-50c086135a49
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20201118094405-356aa54a63d2
|
||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20201114090208-1e84b325f5ba
|
||||
k8s.io/component-helpers => k8s.io/component-helpers v0.0.0-20201114090304-7cb42b694587
|
||||
|
|
4
go.sum
4
go.sum
|
@ -634,10 +634,10 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/api v0.0.0-20201209045732-d10e393578ca/go.mod h1:xjrWEKNUnu5XTPx3c+1VDDkb3vXmUiTwwHureX1M32c=
|
||||
k8s.io/api v0.0.0-20201209045733-fcac651617f2/go.mod h1:xjrWEKNUnu5XTPx3c+1VDDkb3vXmUiTwwHureX1M32c=
|
||||
k8s.io/apimachinery v0.0.0-20201209005534-8f01ffc4dcb8/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
|
||||
k8s.io/cli-runtime v0.0.0-20201114091436-bb334014705f/go.mod h1:tBt/bdEvlky4pwrXkvcYnl7N6IlY9j7NHTWBUSZZ56c=
|
||||
k8s.io/client-go v0.0.0-20201121005859-fb61a7c88cb9/go.mod h1:UTdyXFcu9VZV4qQRKGXCa0KdMX4HTCXClRs4s7yFdDQ=
|
||||
k8s.io/client-go v0.0.0-20201209050020-50c086135a49/go.mod h1:Q03o4QoSHu+g03slrI4m9ZNgSbmkR8t7mwyWkhKnIEA=
|
||||
k8s.io/code-generator v0.0.0-20201118094405-356aa54a63d2/go.mod h1:UsqdF+VX4PU2g46NC2JRs4gc+IfrctnwHb76RNbWHJg=
|
||||
k8s.io/component-base v0.0.0-20201114090208-1e84b325f5ba/go.mod h1:g6NgUWq2J9mdXytMdP+mNUKEH3kQqHysQcJz3HJEh/U=
|
||||
k8s.io/component-helpers v0.0.0-20201114090304-7cb42b694587/go.mod h1:Fb+7xcdRsPnQNQnXkqMwptC6LsONZr10ris8YPJw1bk=
|
||||
|
|
|
@ -1178,7 +1178,7 @@ func TestGenerateNodeDebugPod(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCompleteAndValidate(t *testing.T) {
|
||||
tf := cmdtesting.NewTestFactory()
|
||||
tf := cmdtesting.NewTestFactory().WithNamespace("test")
|
||||
ioStreams, _, _, _ := genericclioptions.NewTestIOStreams()
|
||||
cmpFilter := cmp.FilterPath(func(p cmp.Path) bool {
|
||||
switch p.String() {
|
||||
|
@ -1225,7 +1225,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
wantOpts: &DebugOptions{
|
||||
Args: []string{},
|
||||
Image: "busybox",
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
PullPolicy: corev1.PullPolicy("Always"),
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod"},
|
||||
|
@ -1237,7 +1237,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
wantOpts: &DebugOptions{
|
||||
Args: []string{},
|
||||
Image: "busybox",
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod1", "mypod2"},
|
||||
},
|
||||
|
@ -1248,7 +1248,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
wantOpts: &DebugOptions{
|
||||
Args: []string{"echo", "1", "2"},
|
||||
Image: "busybox",
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod1", "mypod2"},
|
||||
},
|
||||
|
@ -1261,7 +1261,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
Attach: false,
|
||||
Image: "busybox",
|
||||
Interactive: true,
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod"},
|
||||
TTY: true,
|
||||
|
@ -1274,7 +1274,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
Args: []string{},
|
||||
Env: []v1.EnvVar{{Name: "FOO", Value: "BAR"}},
|
||||
Image: "busybox",
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod"},
|
||||
},
|
||||
|
@ -1287,7 +1287,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
Attach: true,
|
||||
Image: "busybox",
|
||||
Interactive: true,
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod"},
|
||||
TTY: true,
|
||||
|
@ -1300,7 +1300,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
Args: []string{},
|
||||
Container: "debugger",
|
||||
Image: "myproj/debug-tools",
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
PullPolicy: corev1.PullPolicy("Always"),
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod"},
|
||||
|
@ -1340,7 +1340,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
CopyTo: "my-debugger",
|
||||
Image: "busybox",
|
||||
Interactive: true,
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod"},
|
||||
TTY: true,
|
||||
|
@ -1354,7 +1354,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
Container: "my-container",
|
||||
CopyTo: "my-debugger",
|
||||
Image: "busybox",
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod"},
|
||||
},
|
||||
|
@ -1367,7 +1367,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
Attach: true,
|
||||
CopyTo: "my-debugger",
|
||||
Image: "busybox",
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod"},
|
||||
},
|
||||
|
@ -1380,7 +1380,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
Container: "my-container",
|
||||
CopyTo: "my-debugger",
|
||||
Image: "busybox",
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod"},
|
||||
},
|
||||
|
@ -1391,7 +1391,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
wantOpts: &DebugOptions{
|
||||
Args: []string{},
|
||||
CopyTo: "my-debugger",
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
SetImages: map[string]string{
|
||||
"*": "busybox",
|
||||
"app": "app-debugger",
|
||||
|
@ -1409,7 +1409,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
CopyTo: "my-debugger",
|
||||
Image: "debian",
|
||||
Interactive: true,
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
SetImages: map[string]string{
|
||||
"app": "app:debug",
|
||||
"sidecar": "sidecar:debug",
|
||||
|
@ -1428,7 +1428,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
Container: "mycontainer",
|
||||
CopyTo: "my-debugger",
|
||||
Interactive: true,
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"mypod"},
|
||||
TTY: true,
|
||||
|
@ -1467,7 +1467,7 @@ func TestCompleteAndValidate(t *testing.T) {
|
|||
Attach: true,
|
||||
Image: "busybox",
|
||||
Interactive: true,
|
||||
Namespace: "default",
|
||||
Namespace: "test",
|
||||
ShareProcesses: true,
|
||||
TargetNames: []string{"node/mynode"},
|
||||
TTY: true,
|
||||
|
|
|
@ -560,7 +560,7 @@ func TestExpose(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
|
||||
tf := cmdtesting.NewTestFactory()
|
||||
tf := cmdtesting.NewTestFactory().WithNamespace("test")
|
||||
defer tf.Cleanup()
|
||||
|
||||
codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...)
|
||||
|
@ -570,11 +570,11 @@ func TestExpose(t *testing.T) {
|
|||
Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
|
||||
t.Logf("path: %v, method: %v", req.URL.Path, req.Method)
|
||||
switch p, m := req.URL.Path, req.Method; {
|
||||
case m == "POST" && p == "/namespaces/default/pods":
|
||||
case m == "POST" && p == "/namespaces/test/pods":
|
||||
pod := &corev1.Pod{}
|
||||
body := cmdtesting.ObjBody(codec, pod)
|
||||
return &http.Response{StatusCode: http.StatusOK, Header: cmdtesting.DefaultHeader(), Body: body}, nil
|
||||
case m == "POST" && p == "/namespaces/default/services":
|
||||
case m == "POST" && p == "/namespaces/test/services":
|
||||
data, err := ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
|
|
Loading…
Reference in New Issue