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