mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-12 13:31:52 +00:00
removing references to pre v1beta3 apis
This commit is contained in:
parent
8278928b66
commit
fc4da6844e
@ -467,7 +467,6 @@ runTests() {
|
|||||||
|
|
||||||
### Printing pod templates works
|
### Printing pod templates works
|
||||||
kubectl get podtemplates "${kube_flags[@]}"
|
kubectl get podtemplates "${kube_flags[@]}"
|
||||||
### Display of an object which doesn't existing in v1beta1 and v1beta2 works
|
|
||||||
[[ "$(kubectl get podtemplates -o yaml "${kube_flags[@]}" | grep nginx)" ]]
|
[[ "$(kubectl get podtemplates -o yaml "${kube_flags[@]}" | grep nginx)" ]]
|
||||||
|
|
||||||
### Delete nginx pod template by name
|
### Delete nginx pod template by name
|
||||||
@ -733,20 +732,6 @@ __EOF__
|
|||||||
# Post-condition: node is schedulable
|
# Post-condition: node is schedulable
|
||||||
kube::test::get_object_assert "nodes 127.0.0.1" "{{.spec.unschedulable}}" '<no value>'
|
kube::test::get_object_assert "nodes 127.0.0.1" "{{.spec.unschedulable}}" '<no value>'
|
||||||
|
|
||||||
###########
|
|
||||||
# Nodes #
|
|
||||||
###########
|
|
||||||
|
|
||||||
if [[ "${version}" = "v1beta1" ]] || [[ "${version}" = "v1beta2" ]]; then
|
|
||||||
kube::log::status "Testing kubectl(${version}:nodes)"
|
|
||||||
|
|
||||||
kube::test::get_object_assert nodes "{{range.items}}{{$id_field}}:{{end}}" '127.0.0.1:'
|
|
||||||
|
|
||||||
kube::test::get_object_assert nodes '{{.kind}}' 'List'
|
|
||||||
|
|
||||||
kube::test::describe_object_assert nodes "127.0.0.1" "Name:" "Conditions:" "Addresses:" "Capacity:" "Pods:"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# Retrieve multiple #
|
# Retrieve multiple #
|
||||||
|
@ -66,8 +66,7 @@ type typeMeta struct {
|
|||||||
// can be mapped with the provided MetadataAccessor and Codec interfaces.
|
// can be mapped with the provided MetadataAccessor and Codec interfaces.
|
||||||
//
|
//
|
||||||
// The resource name of a Kind is defined as the lowercase,
|
// The resource name of a Kind is defined as the lowercase,
|
||||||
// English-plural version of the Kind string in v1beta3 and onwards,
|
// English-plural version of the Kind string.
|
||||||
// and as the camelCase version of the name in v1beta1 and v1beta2.
|
|
||||||
// When converting from resource to Kind, the singular version of the
|
// When converting from resource to Kind, the singular version of the
|
||||||
// resource name is also accepted for convenience.
|
// resource name is also accepted for convenience.
|
||||||
//
|
//
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/registered"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||||
@ -202,7 +203,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
|
|||||||
ev.ValueFrom = &api.EnvVarSource{}
|
ev.ValueFrom = &api.EnvVarSource{}
|
||||||
ev.ValueFrom.FieldRef = &api.ObjectFieldSelector{}
|
ev.ValueFrom.FieldRef = &api.ObjectFieldSelector{}
|
||||||
|
|
||||||
versions := []string{"v1beta1", "v1beta2", "v1beta3"}
|
versions := registered.RegisteredVersions
|
||||||
|
|
||||||
ev.ValueFrom.FieldRef.APIVersion = versions[c.Rand.Intn(len(versions))]
|
ev.ValueFrom.FieldRef.APIVersion = versions[c.Rand.Intn(len(versions))]
|
||||||
ev.ValueFrom.FieldRef.FieldPath = c.RandString()
|
ev.ValueFrom.FieldRef.FieldPath = c.RandString()
|
||||||
|
@ -35,24 +35,13 @@ type RootPaths struct {
|
|||||||
Paths []string `json:"paths"`
|
Paths []string `json:"paths"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// preV1Beta3 returns true if the provided API version is an API introduced before v1beta3.
|
|
||||||
func PreV1Beta3(version string) bool {
|
|
||||||
return version == "v1beta1" || version == "v1beta2"
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: remove me when watch is refactored
|
// TODO: remove me when watch is refactored
|
||||||
func LabelSelectorQueryParam(version string) string {
|
func LabelSelectorQueryParam(version string) string {
|
||||||
if PreV1Beta3(version) {
|
|
||||||
return "labels"
|
|
||||||
}
|
|
||||||
return "labelSelector"
|
return "labelSelector"
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove me when watch is refactored
|
// TODO: remove me when watch is refactored
|
||||||
func FieldSelectorQueryParam(version string) string {
|
func FieldSelectorQueryParam(version string) string {
|
||||||
if PreV1Beta3(version) {
|
|
||||||
return "fields"
|
|
||||||
}
|
|
||||||
return "fieldSelector"
|
return "fieldSelector"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,15 +164,13 @@ func (c *testClient) ValidateCommon(t *testing.T, err error) {
|
|||||||
// buildResourcePath is a convenience function for knowing if a namespace should be in a path param or not
|
// buildResourcePath is a convenience function for knowing if a namespace should be in a path param or not
|
||||||
func buildResourcePath(namespace, resource string) string {
|
func buildResourcePath(namespace, resource string) string {
|
||||||
if len(namespace) > 0 {
|
if len(namespace) > 0 {
|
||||||
if !(testapi.Version() == "v1beta1" || testapi.Version() == "v1beta2") {
|
return path.Join("namespaces", namespace, resource)
|
||||||
return path.Join("namespaces", namespace, resource)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return resource
|
return resource
|
||||||
}
|
}
|
||||||
|
|
||||||
// buildQueryValues is a convenience function for knowing if a namespace should be in a query param or not
|
// buildQueryValues is a convenience function for knowing if a namespace should be in a query param or not
|
||||||
func buildQueryValues(namespace string, query url.Values) url.Values {
|
func buildQueryValues(query url.Values) url.Values {
|
||||||
v := url.Values{}
|
v := url.Values{}
|
||||||
if query != nil {
|
if query != nil {
|
||||||
for key, values := range query {
|
for key, values := range query {
|
||||||
@ -181,11 +179,6 @@ func buildQueryValues(namespace string, query url.Values) url.Values {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(namespace) > 0 {
|
|
||||||
if api.PreV1Beta3(testapi.Version()) {
|
|
||||||
v.Set("namespace", namespace)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
func TestListEndpoints(t *testing.T) {
|
func TestListEndpoints(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "GET", Path: testapi.ResourcePath("endpoints", ns, ""), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "GET", Path: testapi.ResourcePath("endpoints", ns, ""), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200,
|
Response: Response{StatusCode: 200,
|
||||||
Body: &api.EndpointsList{
|
Body: &api.EndpointsList{
|
||||||
Items: []api.Endpoints{
|
Items: []api.Endpoints{
|
||||||
@ -49,7 +49,7 @@ func TestListEndpoints(t *testing.T) {
|
|||||||
func TestGetEndpoints(t *testing.T) {
|
func TestGetEndpoints(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "GET", Path: testapi.ResourcePath("endpoints", ns, "endpoint-1"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "GET", Path: testapi.ResourcePath("endpoints", ns, "endpoint-1"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: &api.Endpoints{ObjectMeta: api.ObjectMeta{Name: "endpoint-1"}}},
|
Response: Response{StatusCode: 200, Body: &api.Endpoints{ObjectMeta: api.ObjectMeta{Name: "endpoint-1"}}},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().Endpoints(ns).Get("endpoint-1")
|
response, err := c.Setup().Endpoints(ns).Get("endpoint-1")
|
||||||
|
@ -192,8 +192,5 @@ func (e *events) GetFieldSelector(involvedObjectName, involvedObjectNamespace, i
|
|||||||
|
|
||||||
// Returns the appropriate field label to use for name of the involved object as per the given API version.
|
// Returns the appropriate field label to use for name of the involved object as per the given API version.
|
||||||
func getInvolvedObjectNameFieldLabel(version string) string {
|
func getInvolvedObjectNameFieldLabel(version string) string {
|
||||||
if api.PreV1Beta3(version) {
|
|
||||||
return "involvedObject.id"
|
|
||||||
}
|
|
||||||
return "involvedObject.name"
|
return "involvedObject.name"
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ func TestLimitRangeCreate(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "POST",
|
Method: "POST",
|
||||||
Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, ""),
|
Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, ""),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: limitRange,
|
Body: limitRange,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: limitRange},
|
Response: Response{StatusCode: 200, Body: limitRange},
|
||||||
@ -93,7 +93,7 @@ func TestLimitRangeGet(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"),
|
Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: nil,
|
Body: nil,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: limitRange},
|
Response: Response{StatusCode: 200, Body: limitRange},
|
||||||
@ -117,7 +117,7 @@ func TestLimitRangeList(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, ""),
|
Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, ""),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: nil,
|
Body: nil,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: limitRangeList},
|
Response: Response{StatusCode: 200, Body: limitRangeList},
|
||||||
@ -150,7 +150,7 @@ func TestLimitRangeUpdate(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: limitRange},
|
Response: Response{StatusCode: 200, Body: limitRange},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().LimitRanges(ns).Update(limitRange)
|
response, err := c.Setup().LimitRanges(ns).Update(limitRange)
|
||||||
@ -180,7 +180,7 @@ func TestInvalidLimitRangeUpdate(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: limitRange},
|
Response: Response{StatusCode: 200, Body: limitRange},
|
||||||
}
|
}
|
||||||
_, err := c.Setup().LimitRanges(ns).Update(limitRange)
|
_, err := c.Setup().LimitRanges(ns).Update(limitRange)
|
||||||
@ -192,7 +192,7 @@ func TestInvalidLimitRangeUpdate(t *testing.T) {
|
|||||||
func TestLimitRangeDelete(t *testing.T) {
|
func TestLimitRangeDelete(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "foo"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200},
|
Response: Response{StatusCode: 200},
|
||||||
}
|
}
|
||||||
err := c.Setup().LimitRanges(ns).Delete("foo")
|
err := c.Setup().LimitRanges(ns).Delete("foo")
|
||||||
|
@ -49,12 +49,8 @@ func newNodes(c *Client) *nodes {
|
|||||||
return &nodes{c}
|
return &nodes{c}
|
||||||
}
|
}
|
||||||
|
|
||||||
// resourceName returns node's URL resource name based on resource version.
|
// resourceName returns node's URL resource name.
|
||||||
// Uses "minions" as the URL resource name for v1beta1 and v1beta2.
|
|
||||||
func (c *nodes) resourceName() string {
|
func (c *nodes) resourceName() string {
|
||||||
if api.PreV1Beta3(c.r.APIVersion()) {
|
|
||||||
return "minions"
|
|
||||||
}
|
|
||||||
return "nodes"
|
return "nodes"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,13 +44,12 @@ func TestListMinions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestListMinionsLabels(t *testing.T) {
|
func TestListMinionsLabels(t *testing.T) {
|
||||||
ns := api.NamespaceNone
|
|
||||||
labelSelectorQueryParamName := api.LabelSelectorQueryParam(testapi.Version())
|
labelSelectorQueryParamName := api.LabelSelectorQueryParam(testapi.Version())
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getNodesResourceName(), "", ""),
|
Path: testapi.ResourcePath(getNodesResourceName(), "", ""),
|
||||||
Query: buildQueryValues(ns, url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})},
|
Query: buildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &api.NodeList{
|
Body: &api.NodeList{
|
||||||
|
@ -50,7 +50,7 @@ func TestPersistentVolumeCreate(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "POST",
|
Method: "POST",
|
||||||
Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", ""),
|
Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", ""),
|
||||||
Query: buildQueryValues("", nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: pv,
|
Body: pv,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: pv},
|
Response: Response{StatusCode: 200, Body: pv},
|
||||||
@ -79,7 +79,7 @@ func TestPersistentVolumeGet(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "abc"),
|
Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "abc"),
|
||||||
Query: buildQueryValues("", nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: nil,
|
Body: nil,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: persistentVolume},
|
Response: Response{StatusCode: 200, Body: persistentVolume},
|
||||||
@ -101,7 +101,7 @@ func TestPersistentVolumeList(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", ""),
|
Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", ""),
|
||||||
Query: buildQueryValues("", nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: nil,
|
Body: nil,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: persistentVolumeList},
|
Response: Response{StatusCode: 200, Body: persistentVolumeList},
|
||||||
@ -126,7 +126,7 @@ func TestPersistentVolumeUpdate(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "abc"), Query: buildQueryValues("", nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "abc"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: persistentVolume},
|
Response: Response{StatusCode: 200, Body: persistentVolume},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().PersistentVolumes().Update(persistentVolume)
|
response, err := c.Setup().PersistentVolumes().Update(persistentVolume)
|
||||||
@ -156,7 +156,7 @@ func TestPersistentVolumeStatusUpdate(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "PUT",
|
Method: "PUT",
|
||||||
Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "abc") + "/status",
|
Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "abc") + "/status",
|
||||||
Query: buildQueryValues("", nil)},
|
Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: persistentVolume},
|
Response: Response{StatusCode: 200, Body: persistentVolume},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().PersistentVolumes().UpdateStatus(persistentVolume)
|
response, err := c.Setup().PersistentVolumes().UpdateStatus(persistentVolume)
|
||||||
@ -165,7 +165,7 @@ func TestPersistentVolumeStatusUpdate(t *testing.T) {
|
|||||||
|
|
||||||
func TestPersistentVolumeDelete(t *testing.T) {
|
func TestPersistentVolumeDelete(t *testing.T) {
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "foo"), Query: buildQueryValues("", nil)},
|
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPersistentVolumesResoureName(), "", "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200},
|
Response: Response{StatusCode: 200},
|
||||||
}
|
}
|
||||||
err := c.Setup().PersistentVolumes().Delete("foo")
|
err := c.Setup().PersistentVolumes().Delete("foo")
|
||||||
|
@ -54,7 +54,7 @@ func TestPersistentVolumeClaimCreate(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "POST",
|
Method: "POST",
|
||||||
Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, ""),
|
Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, ""),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: pv,
|
Body: pv,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: pv},
|
Response: Response{StatusCode: 200, Body: pv},
|
||||||
@ -87,7 +87,7 @@ func TestPersistentVolumeClaimGet(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc"),
|
Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc"),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: nil,
|
Body: nil,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: persistentVolumeClaim},
|
Response: Response{StatusCode: 200, Body: persistentVolumeClaim},
|
||||||
@ -110,7 +110,7 @@ func TestPersistentVolumeClaimList(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, ""),
|
Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, ""),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: nil,
|
Body: nil,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: persistentVolumeList},
|
Response: Response{StatusCode: 200, Body: persistentVolumeList},
|
||||||
@ -139,7 +139,7 @@ func TestPersistentVolumeClaimUpdate(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: persistentVolumeClaim},
|
Response: Response{StatusCode: 200, Body: persistentVolumeClaim},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().PersistentVolumeClaims(ns).Update(persistentVolumeClaim)
|
response, err := c.Setup().PersistentVolumeClaims(ns).Update(persistentVolumeClaim)
|
||||||
@ -172,7 +172,7 @@ func TestPersistentVolumeClaimStatusUpdate(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "PUT",
|
Method: "PUT",
|
||||||
Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc") + "/status",
|
Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "abc") + "/status",
|
||||||
Query: buildQueryValues(ns, nil)},
|
Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: persistentVolumeClaim},
|
Response: Response{StatusCode: 200, Body: persistentVolumeClaim},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().PersistentVolumeClaims(ns).UpdateStatus(persistentVolumeClaim)
|
response, err := c.Setup().PersistentVolumeClaims(ns).UpdateStatus(persistentVolumeClaim)
|
||||||
@ -182,7 +182,7 @@ func TestPersistentVolumeClaimStatusUpdate(t *testing.T) {
|
|||||||
func TestPersistentVolumeClaimDelete(t *testing.T) {
|
func TestPersistentVolumeClaimDelete(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "foo"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPersistentVolumeClaimsResoureName(), ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200},
|
Response: Response{StatusCode: 200},
|
||||||
}
|
}
|
||||||
err := c.Setup().PersistentVolumeClaims(ns).Delete("foo")
|
err := c.Setup().PersistentVolumeClaims(ns).Delete("foo")
|
||||||
|
@ -43,7 +43,7 @@ func TestPodTemplateCreate(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "POST",
|
Method: "POST",
|
||||||
Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, ""),
|
Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, ""),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: &podTemplate,
|
Body: &podTemplate,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: &podTemplate},
|
Response: Response{StatusCode: 200, Body: &podTemplate},
|
||||||
@ -66,7 +66,7 @@ func TestPodTemplateGet(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "abc"),
|
Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "abc"),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: nil,
|
Body: nil,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: podTemplate},
|
Response: Response{StatusCode: 200, Body: podTemplate},
|
||||||
@ -92,7 +92,7 @@ func TestPodTemplateList(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, ""),
|
Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, ""),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: nil,
|
Body: nil,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: podTemplateList},
|
Response: Response{StatusCode: 200, Body: podTemplateList},
|
||||||
@ -112,7 +112,7 @@ func TestPodTemplateUpdate(t *testing.T) {
|
|||||||
Template: api.PodTemplateSpec{},
|
Template: api.PodTemplateSpec{},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "abc"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "abc"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: podTemplate},
|
Response: Response{StatusCode: 200, Body: podTemplate},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().PodTemplates(ns).Update(podTemplate)
|
response, err := c.Setup().PodTemplates(ns).Update(podTemplate)
|
||||||
@ -122,7 +122,7 @@ func TestPodTemplateUpdate(t *testing.T) {
|
|||||||
func TestPodTemplateDelete(t *testing.T) {
|
func TestPodTemplateDelete(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "foo"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getPodTemplatesResoureName(), ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200},
|
Response: Response{StatusCode: 200},
|
||||||
}
|
}
|
||||||
err := c.Setup().PodTemplates(ns).Delete("foo", nil)
|
err := c.Setup().PodTemplates(ns).Delete("foo", nil)
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
func TestListEmptyPods(t *testing.T) {
|
func TestListEmptyPods(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: &api.PodList{}},
|
Response: Response{StatusCode: 200, Body: &api.PodList{}},
|
||||||
}
|
}
|
||||||
podList, err := c.Setup().Pods(ns).List(labels.Everything(), fields.Everything())
|
podList, err := c.Setup().Pods(ns).List(labels.Everything(), fields.Everything())
|
||||||
@ -39,7 +39,7 @@ func TestListEmptyPods(t *testing.T) {
|
|||||||
func TestListPods(t *testing.T) {
|
func TestListPods(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200,
|
Response: Response{StatusCode: 200,
|
||||||
Body: &api.PodList{
|
Body: &api.PodList{
|
||||||
Items: []api.Pod{
|
Items: []api.Pod{
|
||||||
@ -69,7 +69,7 @@ func TestListPodsLabels(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath("pods", ns, ""),
|
Path: testapi.ResourcePath("pods", ns, ""),
|
||||||
Query: buildQueryValues(ns, url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})},
|
Query: buildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &api.PodList{
|
Body: &api.PodList{
|
||||||
@ -99,7 +99,7 @@ func TestListPodsLabels(t *testing.T) {
|
|||||||
func TestGetPod(t *testing.T) {
|
func TestGetPod(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "GET", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &api.Pod{
|
Body: &api.Pod{
|
||||||
@ -133,7 +133,7 @@ func TestGetPodWithNoName(t *testing.T) {
|
|||||||
func TestDeletePod(t *testing.T) {
|
func TestDeletePod(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200},
|
Response: Response{StatusCode: 200},
|
||||||
}
|
}
|
||||||
err := c.Setup().Pods(ns).Delete("foo", nil)
|
err := c.Setup().Pods(ns).Delete("foo", nil)
|
||||||
@ -154,7 +154,7 @@ func TestCreatePod(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "POST", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(ns, nil), Body: requestPod},
|
Request: testRequest{Method: "POST", Path: testapi.ResourcePath("pods", ns, ""), Query: buildQueryValues(nil), Body: requestPod},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: requestPod,
|
Body: requestPod,
|
||||||
@ -180,7 +180,7 @@ func TestUpdatePod(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: requestPod},
|
Response: Response{StatusCode: 200, Body: requestPod},
|
||||||
}
|
}
|
||||||
receivedPod, err := c.Setup().Pods(ns).Update(requestPod)
|
receivedPod, err := c.Setup().Pods(ns).Update(requestPod)
|
||||||
|
@ -63,7 +63,7 @@ func TestListControllers(t *testing.T) {
|
|||||||
func TestGetController(t *testing.T) {
|
func TestGetController(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "GET", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "GET", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &api.ReplicationController{
|
Body: &api.ReplicationController{
|
||||||
@ -102,7 +102,7 @@ func TestUpdateController(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
|
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &api.ReplicationController{
|
Body: &api.ReplicationController{
|
||||||
@ -127,7 +127,7 @@ func TestUpdateController(t *testing.T) {
|
|||||||
func TestDeleteController(t *testing.T) {
|
func TestDeleteController(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getRCResourceName(), ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200},
|
Response: Response{StatusCode: 200},
|
||||||
}
|
}
|
||||||
err := c.Setup().ReplicationControllers(ns).Delete("foo")
|
err := c.Setup().ReplicationControllers(ns).Delete("foo")
|
||||||
@ -140,7 +140,7 @@ func TestCreateController(t *testing.T) {
|
|||||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "POST", Path: testapi.ResourcePath(getRCResourceName(), ns, ""), Body: requestController, Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "POST", Path: testapi.ResourcePath(getRCResourceName(), ns, ""), Body: requestController, Query: buildQueryValues(nil)},
|
||||||
Response: Response{
|
Response: Response{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
Body: &api.ReplicationController{
|
Body: &api.ReplicationController{
|
||||||
|
@ -53,7 +53,7 @@ func TestResourceQuotaCreate(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "POST",
|
Method: "POST",
|
||||||
Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, ""),
|
Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, ""),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: resourceQuota,
|
Body: resourceQuota,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: resourceQuota},
|
Response: Response{StatusCode: 200, Body: resourceQuota},
|
||||||
@ -85,7 +85,7 @@ func TestResourceQuotaGet(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "abc"),
|
Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "abc"),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: nil,
|
Body: nil,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: resourceQuota},
|
Response: Response{StatusCode: 200, Body: resourceQuota},
|
||||||
@ -109,7 +109,7 @@ func TestResourceQuotaList(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, ""),
|
Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, ""),
|
||||||
Query: buildQueryValues(ns, nil),
|
Query: buildQueryValues(nil),
|
||||||
Body: nil,
|
Body: nil,
|
||||||
},
|
},
|
||||||
Response: Response{StatusCode: 200, Body: resourceQuotaList},
|
Response: Response{StatusCode: 200, Body: resourceQuotaList},
|
||||||
@ -138,7 +138,7 @@ func TestResourceQuotaUpdate(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "abc"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "abc"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: resourceQuota},
|
Response: Response{StatusCode: 200, Body: resourceQuota},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().ResourceQuotas(ns).Update(resourceQuota)
|
response, err := c.Setup().ResourceQuotas(ns).Update(resourceQuota)
|
||||||
@ -168,7 +168,7 @@ func TestResourceQuotaStatusUpdate(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "PUT",
|
Method: "PUT",
|
||||||
Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "abc") + "/status",
|
Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "abc") + "/status",
|
||||||
Query: buildQueryValues(ns, nil)},
|
Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: resourceQuota},
|
Response: Response{StatusCode: 200, Body: resourceQuota},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().ResourceQuotas(ns).UpdateStatus(resourceQuota)
|
response, err := c.Setup().ResourceQuotas(ns).UpdateStatus(resourceQuota)
|
||||||
@ -178,7 +178,7 @@ func TestResourceQuotaStatusUpdate(t *testing.T) {
|
|||||||
func TestResourceQuotaDelete(t *testing.T) {
|
func TestResourceQuotaDelete(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "foo"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath(getResourceQuotasResoureName(), ns, "foo"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200},
|
Response: Response{StatusCode: 200},
|
||||||
}
|
}
|
||||||
err := c.Setup().ResourceQuotas(ns).Delete("foo")
|
err := c.Setup().ResourceQuotas(ns).Delete("foo")
|
||||||
|
@ -31,7 +31,7 @@ func TestListServices(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath("services", ns, ""),
|
Path: testapi.ResourcePath("services", ns, ""),
|
||||||
Query: buildQueryValues(ns, nil)},
|
Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200,
|
Response: Response{StatusCode: 200,
|
||||||
Body: &api.ServiceList{
|
Body: &api.ServiceList{
|
||||||
Items: []api.Service{
|
Items: []api.Service{
|
||||||
@ -65,7 +65,7 @@ func TestListServicesLabels(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath("services", ns, ""),
|
Path: testapi.ResourcePath("services", ns, ""),
|
||||||
Query: buildQueryValues(ns, url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})},
|
Query: buildQueryValues(url.Values{labelSelectorQueryParamName: []string{"foo=bar,name=baz"}})},
|
||||||
Response: Response{StatusCode: 200,
|
Response: Response{StatusCode: 200,
|
||||||
Body: &api.ServiceList{
|
Body: &api.ServiceList{
|
||||||
Items: []api.Service{
|
Items: []api.Service{
|
||||||
@ -100,7 +100,7 @@ func TestGetService(t *testing.T) {
|
|||||||
Request: testRequest{
|
Request: testRequest{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.ResourcePath("services", ns, "1"),
|
Path: testapi.ResourcePath("services", ns, "1"),
|
||||||
Query: buildQueryValues(ns, nil)},
|
Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}},
|
Response: Response{StatusCode: 200, Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().Services(ns).Get("1")
|
response, err := c.Setup().Services(ns).Get("1")
|
||||||
@ -125,7 +125,7 @@ func TestCreateService(t *testing.T) {
|
|||||||
Method: "POST",
|
Method: "POST",
|
||||||
Path: testapi.ResourcePath("services", ns, ""),
|
Path: testapi.ResourcePath("services", ns, ""),
|
||||||
Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}},
|
Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}},
|
||||||
Query: buildQueryValues(ns, nil)},
|
Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}},
|
Response: Response{StatusCode: 200, Body: &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}}},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().Services(ns).Create(&api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}})
|
response, err := c.Setup().Services(ns).Create(&api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1"}})
|
||||||
@ -136,7 +136,7 @@ func TestUpdateService(t *testing.T) {
|
|||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
svc := &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1", ResourceVersion: "1"}}
|
svc := &api.Service{ObjectMeta: api.ObjectMeta{Name: "service-1", ResourceVersion: "1"}}
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath("services", ns, "service-1"), Body: svc, Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "PUT", Path: testapi.ResourcePath("services", ns, "service-1"), Body: svc, Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200, Body: svc},
|
Response: Response{StatusCode: 200, Body: svc},
|
||||||
}
|
}
|
||||||
response, err := c.Setup().Services(ns).Update(svc)
|
response, err := c.Setup().Services(ns).Update(svc)
|
||||||
@ -146,7 +146,7 @@ func TestUpdateService(t *testing.T) {
|
|||||||
func TestDeleteService(t *testing.T) {
|
func TestDeleteService(t *testing.T) {
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
c := &testClient{
|
c := &testClient{
|
||||||
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath("services", ns, "1"), Query: buildQueryValues(ns, nil)},
|
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath("services", ns, "1"), Query: buildQueryValues(nil)},
|
||||||
Response: Response{StatusCode: 200},
|
Response: Response{StatusCode: 200},
|
||||||
}
|
}
|
||||||
err := c.Setup().Services(ns).Delete("1")
|
err := c.Setup().Services(ns).Delete("1")
|
||||||
|
@ -19,6 +19,7 @@ package testclient
|
|||||||
import (
|
import (
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/registered"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
|
||||||
@ -131,7 +132,7 @@ func (c *Fake) ServerVersion() (*version.Info, error) {
|
|||||||
|
|
||||||
func (c *Fake) ServerAPIVersions() (*api.APIVersions, error) {
|
func (c *Fake) ServerAPIVersions() (*api.APIVersions, error) {
|
||||||
c.Actions = append(c.Actions, FakeAction{Action: "get-apiversions", Value: nil})
|
c.Actions = append(c.Actions, FakeAction{Action: "get-apiversions", Value: nil})
|
||||||
return &api.APIVersions{Versions: []string{"v1beta1", "v1beta2"}}, nil
|
return &api.APIVersions{Versions: registered.RegisteredVersions}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Fake) ComponentStatuses() client.ComponentStatusInterface {
|
func (c *Fake) ComponentStatuses() client.ComponentStatusInterface {
|
||||||
|
@ -69,14 +69,10 @@ func applyDefaults(pod *api.Pod, source string, isFile bool, nodeName string) er
|
|||||||
|
|
||||||
func getSelfLink(name, namespace string) string {
|
func getSelfLink(name, namespace string) string {
|
||||||
var selfLink string
|
var selfLink string
|
||||||
if api.PreV1Beta3(latest.Version) {
|
if len(namespace) == 0 {
|
||||||
selfLink = fmt.Sprintf("/api/"+latest.Version+"/pods/%s?namespace=%s", name, namespace)
|
namespace = api.NamespaceDefault
|
||||||
} else {
|
|
||||||
if len(namespace) == 0 {
|
|
||||||
namespace = api.NamespaceDefault
|
|
||||||
}
|
|
||||||
selfLink = fmt.Sprintf("/api/"+latest.Version+"/pods/namespaces/%s/%s", name, namespace)
|
|
||||||
}
|
}
|
||||||
|
selfLink = fmt.Sprintf("/api/"+latest.Version+"/pods/namespaces/%s/%s", name, namespace)
|
||||||
return selfLink
|
return selfLink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,8 +480,6 @@ func (m *Master) init(c *Config) {
|
|||||||
"replicationControllers": controllerStorage,
|
"replicationControllers": controllerStorage,
|
||||||
"services": service.NewStorage(m.serviceRegistry, m.nodeRegistry, m.endpointRegistry, serviceClusterIPAllocator, serviceNodePortAllocator, c.ClusterName),
|
"services": service.NewStorage(m.serviceRegistry, m.nodeRegistry, m.endpointRegistry, serviceClusterIPAllocator, serviceNodePortAllocator, c.ClusterName),
|
||||||
"endpoints": endpointsStorage,
|
"endpoints": endpointsStorage,
|
||||||
"minions": nodeStorage,
|
|
||||||
"minions/status": nodeStatusStorage,
|
|
||||||
"nodes": nodeStorage,
|
"nodes": nodeStorage,
|
||||||
"nodes/status": nodeStatusStorage,
|
"nodes/status": nodeStatusStorage,
|
||||||
"events": event.NewStorage(eventRegistry),
|
"events": event.NewStorage(eventRegistry),
|
||||||
@ -748,9 +746,6 @@ func (m *Master) defaultAPIGroupVersion() *apiserver.APIGroupVersion {
|
|||||||
func (m *Master) api_v1beta3() *apiserver.APIGroupVersion {
|
func (m *Master) api_v1beta3() *apiserver.APIGroupVersion {
|
||||||
storage := make(map[string]rest.Storage)
|
storage := make(map[string]rest.Storage)
|
||||||
for k, v := range m.storage {
|
for k, v := range m.storage {
|
||||||
if k == "minions" || k == "minions/status" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
storage[strings.ToLower(k)] = v
|
storage[strings.ToLower(k)] = v
|
||||||
}
|
}
|
||||||
version := m.defaultAPIGroupVersion()
|
version := m.defaultAPIGroupVersion()
|
||||||
@ -764,9 +759,6 @@ func (m *Master) api_v1beta3() *apiserver.APIGroupVersion {
|
|||||||
func (m *Master) api_v1() *apiserver.APIGroupVersion {
|
func (m *Master) api_v1() *apiserver.APIGroupVersion {
|
||||||
storage := make(map[string]rest.Storage)
|
storage := make(map[string]rest.Storage)
|
||||||
for k, v := range m.storage {
|
for k, v := range m.storage {
|
||||||
if k == "minions" || k == "minions/status" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
storage[strings.ToLower(k)] = v
|
storage[strings.ToLower(k)] = v
|
||||||
}
|
}
|
||||||
version := m.defaultAPIGroupVersion()
|
version := m.defaultAPIGroupVersion()
|
||||||
|
Loading…
Reference in New Issue
Block a user