mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Fix tests that assume core clients use JSON
Signed-off-by: Monis Khan <mok@microsoft.com>
This commit is contained in:
		@@ -73,12 +73,14 @@ func Test_buildClientCertificateManager(t *testing.T) {
 | 
				
			|||||||
	defer s.Close()
 | 
						defer s.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	config1 := &restclient.Config{
 | 
						config1 := &restclient.Config{
 | 
				
			||||||
		UserAgent: "FirstClient",
 | 
							UserAgent:     "FirstClient",
 | 
				
			||||||
		Host:      s.URL,
 | 
							Host:          s.URL,
 | 
				
			||||||
 | 
							ContentConfig: restclient.ContentConfig{ContentType: runtime.ContentTypeJSON},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	config2 := &restclient.Config{
 | 
						config2 := &restclient.Config{
 | 
				
			||||||
		UserAgent: "SecondClient",
 | 
							UserAgent:     "SecondClient",
 | 
				
			||||||
		Host:      s.URL,
 | 
							Host:          s.URL,
 | 
				
			||||||
 | 
							ContentConfig: restclient.ContentConfig{ContentType: runtime.ContentTypeJSON},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	nodeName := types.NodeName("test")
 | 
						nodeName := types.NodeName("test")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -375,7 +375,7 @@ func TestCreatePodsWithGenerateName(t *testing.T) {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			testServer := httptest.NewServer(&fakeHandler)
 | 
								testServer := httptest.NewServer(&fakeHandler)
 | 
				
			||||||
			defer testServer.Close()
 | 
								defer testServer.Close()
 | 
				
			||||||
			clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: testServer.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
 | 
								clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: testServer.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}, ContentType: runtime.ContentTypeJSON}})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			podControl := RealPodControl{
 | 
								podControl := RealPodControl{
 | 
				
			||||||
				KubeClient: clientset,
 | 
									KubeClient: clientset,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,7 @@ import (
 | 
				
			|||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/google/go-cmp/cmp"
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	v1 "k8s.io/api/core/v1"
 | 
						v1 "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"
 | 
				
			||||||
@@ -225,7 +226,7 @@ type endpointController struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func newController(ctx context.Context, url string, batchPeriod time.Duration) *endpointController {
 | 
					func newController(ctx context.Context, url string, batchPeriod time.Duration) *endpointController {
 | 
				
			||||||
	client := clientset.NewForConfigOrDie(&restclient.Config{Host: url, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
 | 
						client := clientset.NewForConfigOrDie(&restclient.Config{Host: url, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}, ContentType: runtime.ContentTypeJSON}})
 | 
				
			||||||
	informerFactory := informers.NewSharedInformerFactory(client, controllerpkg.NoResyncPeriodFunc())
 | 
						informerFactory := informers.NewSharedInformerFactory(client, controllerpkg.NoResyncPeriodFunc())
 | 
				
			||||||
	endpoints := NewEndpointController(ctx, informerFactory.Core().V1().Pods(), informerFactory.Core().V1().Services(),
 | 
						endpoints := NewEndpointController(ctx, informerFactory.Core().V1().Pods(), informerFactory.Core().V1().Services(),
 | 
				
			||||||
		informerFactory.Core().V1().Endpoints(), client, batchPeriod)
 | 
							informerFactory.Core().V1().Endpoints(), client, batchPeriod)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -161,7 +161,7 @@ func TestRunAccessCheck(t *testing.T) {
 | 
				
			|||||||
						test.serverErr
 | 
											test.serverErr
 | 
				
			||||||
				}),
 | 
									}),
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			tf.ClientConfigVal = &restclient.Config{ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}}
 | 
								tf.ClientConfigVal = &restclient.Config{ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}, ContentType: runtime.ContentTypeJSON}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if err := test.o.Complete(tf, test.args); err != nil {
 | 
								if err := test.o.Complete(tf, test.args); err != nil {
 | 
				
			||||||
				t.Errorf("%s: %v", test.name, err)
 | 
									t.Errorf("%s: %v", test.name, err)
 | 
				
			||||||
@@ -196,6 +196,7 @@ func TestRunAccessList(t *testing.T) {
 | 
				
			|||||||
			"            [/version]          []                [get]\n"
 | 
								"            [/version]          []                [get]\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		tf := cmdtesting.NewTestFactory().WithNamespace("test")
 | 
							tf := cmdtesting.NewTestFactory().WithNamespace("test")
 | 
				
			||||||
 | 
							tf.ClientConfigVal.ContentType = runtime.ContentTypeJSON
 | 
				
			||||||
		defer tf.Cleanup()
 | 
							defer tf.Cleanup()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ns := scheme.Codecs.WithoutConversion()
 | 
							ns := scheme.Codecs.WithoutConversion()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user