mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
remove internal version api from kubectl label command
This commit is contained in:
parent
aabee865cd
commit
3fe0d59607
@ -23,10 +23,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/client-go/rest/fake"
|
"k8s.io/client-go/rest/fake"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
|
||||||
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
|
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
|
||||||
"k8s.io/kubernetes/pkg/kubectl/resource"
|
"k8s.io/kubernetes/pkg/kubectl/resource"
|
||||||
)
|
)
|
||||||
@ -164,7 +164,7 @@ func TestLabelFunc(t *testing.T) {
|
|||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
obj: &api.Pod{
|
obj: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b"},
|
Labels: map[string]string{"a": "b"},
|
||||||
},
|
},
|
||||||
@ -173,41 +173,41 @@ func TestLabelFunc(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
obj: &api.Pod{
|
obj: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b"},
|
Labels: map[string]string{"a": "b"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
labels: map[string]string{"a": "c"},
|
labels: map[string]string{"a": "c"},
|
||||||
overwrite: true,
|
overwrite: true,
|
||||||
expected: &api.Pod{
|
expected: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "c"},
|
Labels: map[string]string{"a": "c"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
obj: &api.Pod{
|
obj: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b"},
|
Labels: map[string]string{"a": "b"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
labels: map[string]string{"c": "d"},
|
labels: map[string]string{"c": "d"},
|
||||||
expected: &api.Pod{
|
expected: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b", "c": "d"},
|
Labels: map[string]string{"a": "b", "c": "d"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
obj: &api.Pod{
|
obj: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b"},
|
Labels: map[string]string{"a": "b"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
labels: map[string]string{"c": "d"},
|
labels: map[string]string{"c": "d"},
|
||||||
version: "2",
|
version: "2",
|
||||||
expected: &api.Pod{
|
expected: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b", "c": "d"},
|
Labels: map[string]string{"a": "b", "c": "d"},
|
||||||
ResourceVersion: "2",
|
ResourceVersion: "2",
|
||||||
@ -215,28 +215,28 @@ func TestLabelFunc(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
obj: &api.Pod{
|
obj: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b"},
|
Labels: map[string]string{"a": "b"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
labels: map[string]string{},
|
labels: map[string]string{},
|
||||||
remove: []string{"a"},
|
remove: []string{"a"},
|
||||||
expected: &api.Pod{
|
expected: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{},
|
Labels: map[string]string{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
obj: &api.Pod{
|
obj: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b", "c": "d"},
|
Labels: map[string]string{"a": "b", "c": "d"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
labels: map[string]string{"e": "f"},
|
labels: map[string]string{"e": "f"},
|
||||||
remove: []string{"a"},
|
remove: []string{"a"},
|
||||||
expected: &api.Pod{
|
expected: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"c": "d",
|
"c": "d",
|
||||||
@ -246,11 +246,11 @@ func TestLabelFunc(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
obj: &api.Pod{
|
obj: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{},
|
ObjectMeta: metav1.ObjectMeta{},
|
||||||
},
|
},
|
||||||
labels: map[string]string{"a": "b"},
|
labels: map[string]string{"a": "b"},
|
||||||
expected: &api.Pod{
|
expected: &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"a": "b"},
|
Labels: map[string]string{"a": "b"},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user