Client should validate the incoming host value
Convert host:port and URLs passed to client.New() into the proper values, and return an error if the value is invalid. Change CLI to return an error if -master is invalid. Remove Client.rawRequest which was not in use, and fix the involved tests. Add NewOrDie Preserves the behavior of the client to not auth when a non-https URL is passed (although in the future this should be corrected).
This commit is contained in:
@@ -114,7 +114,7 @@ func TestSyncReplicationControllerDoesNothing(t *testing.T) {
|
||||
ResponseBody: string(body),
|
||||
}
|
||||
testServer := httptest.NewTLSServer(&fakeHandler)
|
||||
client := client.New(testServer.URL, nil)
|
||||
client := client.NewOrDie(testServer.URL, nil)
|
||||
|
||||
fakePodControl := FakePodControl{}
|
||||
|
||||
@@ -134,7 +134,7 @@ func TestSyncReplicationControllerDeletes(t *testing.T) {
|
||||
ResponseBody: string(body),
|
||||
}
|
||||
testServer := httptest.NewTLSServer(&fakeHandler)
|
||||
client := client.New(testServer.URL, nil)
|
||||
client := client.NewOrDie(testServer.URL, nil)
|
||||
|
||||
fakePodControl := FakePodControl{}
|
||||
|
||||
@@ -154,7 +154,7 @@ func TestSyncReplicationControllerCreates(t *testing.T) {
|
||||
ResponseBody: string(body),
|
||||
}
|
||||
testServer := httptest.NewTLSServer(&fakeHandler)
|
||||
client := client.New(testServer.URL, nil)
|
||||
client := client.NewOrDie(testServer.URL, nil)
|
||||
|
||||
fakePodControl := FakePodControl{}
|
||||
|
||||
@@ -174,7 +174,7 @@ func TestCreateReplica(t *testing.T) {
|
||||
ResponseBody: string(body),
|
||||
}
|
||||
testServer := httptest.NewTLSServer(&fakeHandler)
|
||||
client := client.New(testServer.URL, nil)
|
||||
client := client.NewOrDie(testServer.URL, nil)
|
||||
|
||||
podControl := RealPodControl{
|
||||
kubeClient: client,
|
||||
@@ -307,7 +307,7 @@ func TestSyncronize(t *testing.T) {
|
||||
t.Errorf("Unexpected request for %v", req.RequestURI)
|
||||
})
|
||||
testServer := httptest.NewServer(mux)
|
||||
client := client.New(testServer.URL, nil)
|
||||
client := client.NewOrDie(testServer.URL, nil)
|
||||
manager := NewReplicationManager(client)
|
||||
fakePodControl := FakePodControl{}
|
||||
manager.podControl = &fakePodControl
|
||||
|
Reference in New Issue
Block a user