mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Fix tests that assume core clients use JSON
Signed-off-by: Monis Khan <mok@microsoft.com>
This commit is contained in:
parent
032e7f1556
commit
6595fa4026
@ -73,12 +73,14 @@ func Test_buildClientCertificateManager(t *testing.T) {
|
||||
defer s.Close()
|
||||
|
||||
config1 := &restclient.Config{
|
||||
UserAgent: "FirstClient",
|
||||
Host: s.URL,
|
||||
UserAgent: "FirstClient",
|
||||
Host: s.URL,
|
||||
ContentConfig: restclient.ContentConfig{ContentType: runtime.ContentTypeJSON},
|
||||
}
|
||||
config2 := &restclient.Config{
|
||||
UserAgent: "SecondClient",
|
||||
Host: s.URL,
|
||||
UserAgent: "SecondClient",
|
||||
Host: s.URL,
|
||||
ContentConfig: restclient.ContentConfig{ContentType: runtime.ContentTypeJSON},
|
||||
}
|
||||
|
||||
nodeName := types.NodeName("test")
|
||||
|
@ -375,7 +375,7 @@ func TestCreatePodsWithGenerateName(t *testing.T) {
|
||||
}
|
||||
testServer := httptest.NewServer(&fakeHandler)
|
||||
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{
|
||||
KubeClient: clientset,
|
||||
|
@ -27,6 +27,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@ -225,7 +226,7 @@ type endpointController struct {
|
||||
}
|
||||
|
||||
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())
|
||||
endpoints := NewEndpointController(ctx, informerFactory.Core().V1().Pods(), informerFactory.Core().V1().Services(),
|
||||
informerFactory.Core().V1().Endpoints(), client, batchPeriod)
|
||||
|
@ -161,7 +161,7 @@ func TestRunAccessCheck(t *testing.T) {
|
||||
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 {
|
||||
t.Errorf("%s: %v", test.name, err)
|
||||
@ -196,6 +196,7 @@ func TestRunAccessList(t *testing.T) {
|
||||
" [/version] [] [get]\n"
|
||||
|
||||
tf := cmdtesting.NewTestFactory().WithNamespace("test")
|
||||
tf.ClientConfigVal.ContentType = runtime.ContentTypeJSON
|
||||
defer tf.Cleanup()
|
||||
|
||||
ns := scheme.Codecs.WithoutConversion()
|
||||
|
Loading…
Reference in New Issue
Block a user