mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Move pkg/client/unvrsioned#testClient to pkg/client/unversioned/testclient#simple
This commit is contained in:
		@@ -14,7 +14,12 @@ See the License for the specific language governing permissions and
 | 
			
		||||
limitations under the License.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
package unversioned
 | 
			
		||||
package unversioned_test
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	. "k8s.io/kubernetes/pkg/client/unversioned"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/client/unversioned/testclient/simple"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"net/url"
 | 
			
		||||
@@ -30,13 +35,13 @@ func TestNamespaceCreate(t *testing.T) {
 | 
			
		||||
	namespace := &api.Namespace{
 | 
			
		||||
		ObjectMeta: api.ObjectMeta{Name: "foo"},
 | 
			
		||||
	}
 | 
			
		||||
	c := &testClient{
 | 
			
		||||
		Request: testRequest{
 | 
			
		||||
	c := &simple.Client{
 | 
			
		||||
		Request: simple.Request{
 | 
			
		||||
			Method: "POST",
 | 
			
		||||
			Path:   testapi.Default.ResourcePath("namespaces", "", ""),
 | 
			
		||||
			Body:   namespace,
 | 
			
		||||
		},
 | 
			
		||||
		Response: Response{StatusCode: 200, Body: namespace},
 | 
			
		||||
		Response: simple.Response{StatusCode: 200, Body: namespace},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// from the source ns, provision a new global namespace "foo"
 | 
			
		||||
@@ -55,13 +60,13 @@ func TestNamespaceGet(t *testing.T) {
 | 
			
		||||
	namespace := &api.Namespace{
 | 
			
		||||
		ObjectMeta: api.ObjectMeta{Name: "foo"},
 | 
			
		||||
	}
 | 
			
		||||
	c := &testClient{
 | 
			
		||||
		Request: testRequest{
 | 
			
		||||
	c := &simple.Client{
 | 
			
		||||
		Request: simple.Request{
 | 
			
		||||
			Method: "GET",
 | 
			
		||||
			Path:   testapi.Default.ResourcePath("namespaces", "", "foo"),
 | 
			
		||||
			Body:   nil,
 | 
			
		||||
		},
 | 
			
		||||
		Response: Response{StatusCode: 200, Body: namespace},
 | 
			
		||||
		Response: simple.Response{StatusCode: 200, Body: namespace},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	response, err := c.Setup(t).Namespaces().Get("foo")
 | 
			
		||||
@@ -83,13 +88,13 @@ func TestNamespaceList(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	c := &testClient{
 | 
			
		||||
		Request: testRequest{
 | 
			
		||||
	c := &simple.Client{
 | 
			
		||||
		Request: simple.Request{
 | 
			
		||||
			Method: "GET",
 | 
			
		||||
			Path:   testapi.Default.ResourcePath("namespaces", "", ""),
 | 
			
		||||
			Body:   nil,
 | 
			
		||||
		},
 | 
			
		||||
		Response: Response{StatusCode: 200, Body: namespaceList},
 | 
			
		||||
		Response: simple.Response{StatusCode: 200, Body: namespaceList},
 | 
			
		||||
	}
 | 
			
		||||
	response, err := c.Setup(t).Namespaces().List(unversioned.ListOptions{})
 | 
			
		||||
 | 
			
		||||
@@ -121,11 +126,11 @@ func TestNamespaceUpdate(t *testing.T) {
 | 
			
		||||
			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	c := &testClient{
 | 
			
		||||
		Request: testRequest{
 | 
			
		||||
	c := &simple.Client{
 | 
			
		||||
		Request: simple.Request{
 | 
			
		||||
			Method: "PUT",
 | 
			
		||||
			Path:   testapi.Default.ResourcePath("namespaces", "", "foo")},
 | 
			
		||||
		Response: Response{StatusCode: 200, Body: requestNamespace},
 | 
			
		||||
		Response: simple.Response{StatusCode: 200, Body: requestNamespace},
 | 
			
		||||
	}
 | 
			
		||||
	receivedNamespace, err := c.Setup(t).Namespaces().Update(requestNamespace)
 | 
			
		||||
	c.Validate(t, receivedNamespace, err)
 | 
			
		||||
@@ -145,33 +150,33 @@ func TestNamespaceFinalize(t *testing.T) {
 | 
			
		||||
			Finalizers: []api.FinalizerName{api.FinalizerKubernetes},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	c := &testClient{
 | 
			
		||||
		Request: testRequest{
 | 
			
		||||
	c := &simple.Client{
 | 
			
		||||
		Request: simple.Request{
 | 
			
		||||
			Method: "PUT",
 | 
			
		||||
			Path:   testapi.Default.ResourcePath("namespaces", "", "foo") + "/finalize",
 | 
			
		||||
		},
 | 
			
		||||
		Response: Response{StatusCode: 200, Body: requestNamespace},
 | 
			
		||||
		Response: simple.Response{StatusCode: 200, Body: requestNamespace},
 | 
			
		||||
	}
 | 
			
		||||
	receivedNamespace, err := c.Setup(t).Namespaces().Finalize(requestNamespace)
 | 
			
		||||
	c.Validate(t, receivedNamespace, err)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestNamespaceDelete(t *testing.T) {
 | 
			
		||||
	c := &testClient{
 | 
			
		||||
		Request:  testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath("namespaces", "", "foo")},
 | 
			
		||||
		Response: Response{StatusCode: 200},
 | 
			
		||||
	c := &simple.Client{
 | 
			
		||||
		Request:  simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath("namespaces", "", "foo")},
 | 
			
		||||
		Response: simple.Response{StatusCode: 200},
 | 
			
		||||
	}
 | 
			
		||||
	err := c.Setup(t).Namespaces().Delete("foo")
 | 
			
		||||
	c.Validate(t, nil, err)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestNamespaceWatch(t *testing.T) {
 | 
			
		||||
	c := &testClient{
 | 
			
		||||
		Request: testRequest{
 | 
			
		||||
	c := &simple.Client{
 | 
			
		||||
		Request: simple.Request{
 | 
			
		||||
			Method: "GET",
 | 
			
		||||
			Path:   testapi.Default.ResourcePathWithPrefix("watch", "namespaces", "", ""),
 | 
			
		||||
			Query:  url.Values{"resourceVersion": []string{}}},
 | 
			
		||||
		Response: Response{StatusCode: 200},
 | 
			
		||||
		Response: simple.Response{StatusCode: 200},
 | 
			
		||||
	}
 | 
			
		||||
	_, err := c.Setup(t).Namespaces().Watch(unversioned.ListOptions{})
 | 
			
		||||
	c.Validate(t, nil, err)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user