mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
Remove selflink references in different testing-related files
This commit is contained in:
parent
8c6b910e68
commit
551790729f
@ -18,7 +18,6 @@ package cronjob
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
@ -143,7 +142,6 @@ func (f *fakeJobControl) CreateJob(namespace string, job *batchv1.Job) (*batchv1
|
|||||||
if f.CreateErr != nil {
|
if f.CreateErr != nil {
|
||||||
return nil, f.CreateErr
|
return nil, f.CreateErr
|
||||||
}
|
}
|
||||||
job.SelfLink = fmt.Sprintf("/apis/batch/v1/namespaces/%s/jobs/%s", namespace, job.Name)
|
|
||||||
f.Jobs = append(f.Jobs, *job)
|
f.Jobs = append(f.Jobs, *job)
|
||||||
job.UID = "test-uid"
|
job.UID = "test-uid"
|
||||||
return job, nil
|
return job, nil
|
||||||
|
@ -43,7 +43,6 @@ func TestGetJobFromTemplate2(t *testing.T) {
|
|||||||
Name: "mycronjob",
|
Name: "mycronjob",
|
||||||
Namespace: "snazzycats",
|
Namespace: "snazzycats",
|
||||||
UID: types.UID("1a2b3c"),
|
UID: types.UID("1a2b3c"),
|
||||||
SelfLink: "/apis/batch/v1/namespaces/snazzycats/jobs/mycronjob",
|
|
||||||
},
|
},
|
||||||
Spec: batchv1.CronJobSpec{
|
Spec: batchv1.CronJobSpec{
|
||||||
Schedule: "* * * * ?",
|
Schedule: "* * * * ?",
|
||||||
|
@ -209,7 +209,6 @@ func (tc *testCase) prepareTestClient(t *testing.T) (*fake.Clientset, *metricsfa
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: hpaName,
|
Name: hpaName,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
SelfLink: "experimental/v1/namespaces/" + namespace + "/horizontalpodautoscalers/" + hpaName,
|
|
||||||
},
|
},
|
||||||
Spec: autoscalingv2.HorizontalPodAutoscalerSpec{
|
Spec: autoscalingv2.HorizontalPodAutoscalerSpec{
|
||||||
ScaleTargetRef: autoscalingv2.CrossVersionObjectReference{
|
ScaleTargetRef: autoscalingv2.CrossVersionObjectReference{
|
||||||
@ -2876,7 +2875,6 @@ func TestAvoidUnnecessaryUpdates(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "test-hpa",
|
Name: "test-hpa",
|
||||||
Namespace: "test-namespace",
|
Namespace: "test-namespace",
|
||||||
SelfLink: "experimental/v1/namespaces/test-namespace/horizontalpodautoscalers/test-hpa",
|
|
||||||
},
|
},
|
||||||
Spec: autoscalingv2.HorizontalPodAutoscalerSpec{
|
Spec: autoscalingv2.HorizontalPodAutoscalerSpec{
|
||||||
ScaleTargetRef: autoscalingv2.CrossVersionObjectReference{
|
ScaleTargetRef: autoscalingv2.CrossVersionObjectReference{
|
||||||
|
@ -404,8 +404,6 @@ func newClaim(name, claimUID, capacity, boundToVolume string, phase v1.Persisten
|
|||||||
Phase: phase,
|
Phase: phase,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// Make sure ref.GetReference(claim) works
|
|
||||||
claim.ObjectMeta.SelfLink = "/api/v1/namespaces/" + testNamespace + "/persistentvolumeclaims/" + name
|
|
||||||
|
|
||||||
if len(annotations) > 0 {
|
if len(annotations) > 0 {
|
||||||
claim.Annotations = make(map[string]string)
|
claim.Annotations = make(map[string]string)
|
||||||
|
@ -1296,7 +1296,6 @@ func TestFindingPreboundVolumes(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "claim01",
|
Name: "claim01",
|
||||||
Namespace: "myns",
|
Namespace: "myns",
|
||||||
SelfLink: "/api/v1/namespaces/myns/persistentvolumeclaims/claim01",
|
|
||||||
},
|
},
|
||||||
Spec: v1.PersistentVolumeClaimSpec{
|
Spec: v1.PersistentVolumeClaimSpec{
|
||||||
AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce},
|
AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce},
|
||||||
|
@ -622,7 +622,6 @@ func makeTestPVC(name, size, node string, pvcBoundState int, pvName, resourceVer
|
|||||||
Namespace: "testns",
|
Namespace: "testns",
|
||||||
UID: types.UID("pvc-uid"),
|
UID: types.UID("pvc-uid"),
|
||||||
ResourceVersion: resourceVersion,
|
ResourceVersion: resourceVersion,
|
||||||
SelfLink: "/api/v1/namespaces/testns/persistentvolumeclaims/" + name,
|
|
||||||
},
|
},
|
||||||
Spec: v1.PersistentVolumeClaimSpec{
|
Spec: v1.PersistentVolumeClaimSpec{
|
||||||
Resources: v1.ResourceRequirements{
|
Resources: v1.ResourceRequirements{
|
||||||
|
@ -360,7 +360,6 @@ func TestEtcdStorage(t *testing.T) {
|
|||||||
Metadata: Metadata{
|
Metadata: Metadata{
|
||||||
Name: "noxus.mygroup.example.com",
|
Name: "noxus.mygroup.example.com",
|
||||||
Namespace: "",
|
Namespace: "",
|
||||||
SelfLink: "",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -372,7 +371,6 @@ func TestEtcdStorage(t *testing.T) {
|
|||||||
Metadata: Metadata{
|
Metadata: Metadata{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: "the-cruel-default",
|
Namespace: "the-cruel-default",
|
||||||
SelfLink: "", // TODO double check: empty?
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -385,7 +383,6 @@ func TestEtcdStorage(t *testing.T) {
|
|||||||
Metadata: Metadata{
|
Metadata: Metadata{
|
||||||
Name: "curlets.mygroup.example.com",
|
Name: "curlets.mygroup.example.com",
|
||||||
Namespace: "",
|
Namespace: "",
|
||||||
SelfLink: "",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -398,7 +395,6 @@ func TestEtcdStorage(t *testing.T) {
|
|||||||
Metadata: Metadata{
|
Metadata: Metadata{
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
Namespace: "",
|
Namespace: "",
|
||||||
SelfLink: "", // TODO double check: empty?
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -452,5 +448,4 @@ type metaObject struct {
|
|||||||
type Metadata struct {
|
type Metadata struct {
|
||||||
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
|
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
|
||||||
Namespace string `json:"namespace,omitempty" protobuf:"bytes,2,opt,name=namespace"`
|
Namespace string `json:"namespace,omitempty" protobuf:"bytes,2,opt,name=namespace"`
|
||||||
SelfLink string `json:"selfLink,omitempty" protobuf:"bytes,3,opt,name=selfLink"`
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ func getArbitraryResource(s schema.GroupVersionResource, name, namespace string)
|
|||||||
"generateName": "test_generateName",
|
"generateName": "test_generateName",
|
||||||
"uid": "test_uid",
|
"uid": "test_uid",
|
||||||
"resourceVersion": "test_resourceVersion",
|
"resourceVersion": "test_resourceVersion",
|
||||||
"selfLink": "test_selfLink",
|
|
||||||
},
|
},
|
||||||
"data": strconv.Itoa(rand.Int()),
|
"data": strconv.Itoa(rand.Int()),
|
||||||
},
|
},
|
||||||
|
@ -216,7 +216,6 @@ func TestFinishSeries(t *testing.T) {
|
|||||||
hostname, _ := os.Hostname()
|
hostname, _ := os.Hostname()
|
||||||
testPod := &v1.Pod{
|
testPod := &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
SelfLink: "/api/v1/namespaces/baz/pods/foo",
|
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: "baz",
|
Namespace: "baz",
|
||||||
UID: "bar",
|
UID: "bar",
|
||||||
@ -288,7 +287,6 @@ func TestRefreshExistingEventSeries(t *testing.T) {
|
|||||||
hostname, _ := os.Hostname()
|
hostname, _ := os.Hostname()
|
||||||
testPod := &v1.Pod{
|
testPod := &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
SelfLink: "/api/v1/namespaces/baz/pods/foo",
|
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: "baz",
|
Namespace: "baz",
|
||||||
UID: "bar",
|
UID: "bar",
|
||||||
|
@ -129,7 +129,6 @@ func TestNonRacyShutdown(t *testing.T) {
|
|||||||
func TestEventf(t *testing.T) {
|
func TestEventf(t *testing.T) {
|
||||||
testPod := &v1.Pod{
|
testPod := &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
SelfLink: "/api/v1/namespaces/baz/pods/foo",
|
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: "baz",
|
Namespace: "baz",
|
||||||
UID: "bar",
|
UID: "bar",
|
||||||
@ -137,7 +136,6 @@ func TestEventf(t *testing.T) {
|
|||||||
}
|
}
|
||||||
testPod2 := &v1.Pod{
|
testPod2 := &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
SelfLink: "/api/v1/namespaces/baz/pods/foo",
|
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: "baz",
|
Namespace: "baz",
|
||||||
UID: "differentUid",
|
UID: "differentUid",
|
||||||
@ -554,9 +552,8 @@ func TestLotsOfEvents(t *testing.T) {
|
|||||||
func TestEventfNoNamespace(t *testing.T) {
|
func TestEventfNoNamespace(t *testing.T) {
|
||||||
testPod := &v1.Pod{
|
testPod := &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
SelfLink: "/api/v1/namespaces/default/pods/foo",
|
Name: "foo",
|
||||||
Name: "foo",
|
UID: "bar",
|
||||||
UID: "bar",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
testRef, err := ref.GetPartialReference(scheme.Scheme, testPod, "spec.containers[2]")
|
testRef, err := ref.GetPartialReference(scheme.Scheme, testPod, "spec.containers[2]")
|
||||||
@ -651,7 +648,6 @@ func TestEventfNoNamespace(t *testing.T) {
|
|||||||
func TestMultiSinkCache(t *testing.T) {
|
func TestMultiSinkCache(t *testing.T) {
|
||||||
testPod := &v1.Pod{
|
testPod := &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
SelfLink: "/api/v1/namespaces/baz/pods/foo",
|
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: "baz",
|
Namespace: "baz",
|
||||||
UID: "bar",
|
UID: "bar",
|
||||||
@ -659,7 +655,6 @@ func TestMultiSinkCache(t *testing.T) {
|
|||||||
}
|
}
|
||||||
testPod2 := &v1.Pod{
|
testPod2 := &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
SelfLink: "/api/v1/namespaces/baz/pods/foo",
|
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: "baz",
|
Namespace: "baz",
|
||||||
UID: "differentUid",
|
UID: "differentUid",
|
||||||
|
@ -43,7 +43,7 @@ func TestGetReferenceRefVersion(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "v1 GV from scheme",
|
name: "v1 GV from scheme",
|
||||||
input: &TestRuntimeObj{
|
input: &TestRuntimeObj{
|
||||||
ObjectMeta: metav1.ObjectMeta{SelfLink: "/bad-selflink/unused"},
|
ObjectMeta: metav1.ObjectMeta{},
|
||||||
},
|
},
|
||||||
groupVersion: schema.GroupVersion{Group: "", Version: "v1"},
|
groupVersion: schema.GroupVersion{Group: "", Version: "v1"},
|
||||||
expectedRefVersion: "v1",
|
expectedRefVersion: "v1",
|
||||||
@ -51,7 +51,7 @@ func TestGetReferenceRefVersion(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "foo.group/v3 GV from scheme",
|
name: "foo.group/v3 GV from scheme",
|
||||||
input: &TestRuntimeObj{
|
input: &TestRuntimeObj{
|
||||||
ObjectMeta: metav1.ObjectMeta{SelfLink: "/bad-selflink/unused"},
|
ObjectMeta: metav1.ObjectMeta{},
|
||||||
},
|
},
|
||||||
groupVersion: schema.GroupVersion{Group: "foo.group", Version: "v3"},
|
groupVersion: schema.GroupVersion{Group: "foo.group", Version: "v3"},
|
||||||
expectedRefVersion: "foo.group/v3",
|
expectedRefVersion: "foo.group/v3",
|
||||||
|
@ -793,8 +793,7 @@ func TestRunningPodsJSONPathOutput(t *testing.T) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"resourceVersion": "",
|
"resourceVersion": ""
|
||||||
"selfLink": ""
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}`)
|
}`)
|
||||||
|
@ -54,7 +54,6 @@ func newService(name string, uid types.UID, serviceType v1.ServiceType) *v1.Serv
|
|||||||
Name: name,
|
Name: name,
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
UID: uid,
|
UID: uid,
|
||||||
SelfLink: "/api/v1/namespaces/default/services/" + name,
|
|
||||||
},
|
},
|
||||||
Spec: v1.ServiceSpec{
|
Spec: v1.ServiceSpec{
|
||||||
Type: serviceType,
|
Type: serviceType,
|
||||||
@ -167,7 +166,6 @@ func TestSyncLoadBalancerIfNeeded(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "udp-service",
|
Name: "udp-service",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
SelfLink: "/api/v1/namespaces/default/services/udp-service",
|
|
||||||
},
|
},
|
||||||
Spec: v1.ServiceSpec{
|
Spec: v1.ServiceSpec{
|
||||||
Ports: []v1.ServicePort{{
|
Ports: []v1.ServicePort{{
|
||||||
@ -188,7 +186,6 @@ func TestSyncLoadBalancerIfNeeded(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "basic-service1",
|
Name: "basic-service1",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
SelfLink: "/api/v1/namespaces/default/services/basic-service1",
|
|
||||||
},
|
},
|
||||||
Spec: v1.ServiceSpec{
|
Spec: v1.ServiceSpec{
|
||||||
Ports: []v1.ServicePort{{
|
Ports: []v1.ServicePort{{
|
||||||
@ -209,7 +206,6 @@ func TestSyncLoadBalancerIfNeeded(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "sctp-service",
|
Name: "sctp-service",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
SelfLink: "/api/v1/namespaces/default/services/sctp-service",
|
|
||||||
},
|
},
|
||||||
Spec: v1.ServiceSpec{
|
Spec: v1.ServiceSpec{
|
||||||
Ports: []v1.ServicePort{{
|
Ports: []v1.ServicePort{{
|
||||||
@ -294,7 +290,6 @@ func TestSyncLoadBalancerIfNeeded(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "basic-service1",
|
Name: "basic-service1",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
SelfLink: "/api/v1/namespaces/default/services/basic-service1",
|
|
||||||
DeletionTimestamp: &metav1.Time{
|
DeletionTimestamp: &metav1.Time{
|
||||||
Time: time.Now(),
|
Time: time.Now(),
|
||||||
},
|
},
|
||||||
@ -327,7 +322,6 @@ func TestSyncLoadBalancerIfNeeded(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "basic-service1",
|
Name: "basic-service1",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
SelfLink: "/api/v1/namespaces/default/services/basic-service1",
|
|
||||||
},
|
},
|
||||||
Spec: v1.ServiceSpec{
|
Spec: v1.ServiceSpec{
|
||||||
Ports: []v1.ServicePort{{
|
Ports: []v1.ServicePort{{
|
||||||
@ -348,7 +342,6 @@ func TestSyncLoadBalancerIfNeeded(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "basic-service1",
|
Name: "basic-service1",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
SelfLink: "/api/v1/namespaces/default/services/basic-service1",
|
|
||||||
Finalizers: []string{servicehelper.LoadBalancerCleanupFinalizer},
|
Finalizers: []string{servicehelper.LoadBalancerCleanupFinalizer},
|
||||||
},
|
},
|
||||||
Spec: v1.ServiceSpec{
|
Spec: v1.ServiceSpec{
|
||||||
|
@ -43,7 +43,6 @@ func TestEventCompatibility(t *testing.T) {
|
|||||||
|
|
||||||
testPod := &v1.Pod{
|
testPod := &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
SelfLink: "/api/v1/namespaces/default/pods/foo",
|
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
UID: "bar",
|
UID: "bar",
|
||||||
|
Loading…
Reference in New Issue
Block a user