mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +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"
|
||||
@@ -48,14 +53,14 @@ func TestResourceQuotaCreate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
c := &testClient{
|
||||
Request: testRequest{
|
||||
c := &simple.Client{
|
||||
Request: simple.Request{
|
||||
Method: "POST",
|
||||
Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, ""),
|
||||
Query: buildQueryValues(nil),
|
||||
Query: simple.BuildQueryValues(nil),
|
||||
Body: resourceQuota,
|
||||
},
|
||||
Response: Response{StatusCode: 200, Body: resourceQuota},
|
||||
Response: simple.Response{StatusCode: 200, Body: resourceQuota},
|
||||
}
|
||||
|
||||
response, err := c.Setup(t).ResourceQuotas(ns).Create(resourceQuota)
|
||||
@@ -80,14 +85,14 @@ func TestResourceQuotaGet(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
c := &testClient{
|
||||
Request: testRequest{
|
||||
c := &simple.Client{
|
||||
Request: simple.Request{
|
||||
Method: "GET",
|
||||
Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "abc"),
|
||||
Query: buildQueryValues(nil),
|
||||
Query: simple.BuildQueryValues(nil),
|
||||
Body: nil,
|
||||
},
|
||||
Response: Response{StatusCode: 200, Body: resourceQuota},
|
||||
Response: simple.Response{StatusCode: 200, Body: resourceQuota},
|
||||
}
|
||||
|
||||
response, err := c.Setup(t).ResourceQuotas(ns).Get("abc")
|
||||
@@ -104,14 +109,14 @@ func TestResourceQuotaList(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
c := &testClient{
|
||||
Request: testRequest{
|
||||
c := &simple.Client{
|
||||
Request: simple.Request{
|
||||
Method: "GET",
|
||||
Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, ""),
|
||||
Query: buildQueryValues(nil),
|
||||
Query: simple.BuildQueryValues(nil),
|
||||
Body: nil,
|
||||
},
|
||||
Response: Response{StatusCode: 200, Body: resourceQuotaList},
|
||||
Response: simple.Response{StatusCode: 200, Body: resourceQuotaList},
|
||||
}
|
||||
response, err := c.Setup(t).ResourceQuotas(ns).List(unversioned.ListOptions{})
|
||||
c.Validate(t, response, err)
|
||||
@@ -136,9 +141,9 @@ func TestResourceQuotaUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
c := &testClient{
|
||||
Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "abc"), Query: buildQueryValues(nil)},
|
||||
Response: Response{StatusCode: 200, Body: resourceQuota},
|
||||
c := &simple.Client{
|
||||
Request: simple.Request{Method: "PUT", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "abc"), Query: simple.BuildQueryValues(nil)},
|
||||
Response: simple.Response{StatusCode: 200, Body: resourceQuota},
|
||||
}
|
||||
response, err := c.Setup(t).ResourceQuotas(ns).Update(resourceQuota)
|
||||
c.Validate(t, response, err)
|
||||
@@ -163,12 +168,12 @@ func TestResourceQuotaStatusUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
c := &testClient{
|
||||
Request: testRequest{
|
||||
c := &simple.Client{
|
||||
Request: simple.Request{
|
||||
Method: "PUT",
|
||||
Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "abc") + "/status",
|
||||
Query: buildQueryValues(nil)},
|
||||
Response: Response{StatusCode: 200, Body: resourceQuota},
|
||||
Query: simple.BuildQueryValues(nil)},
|
||||
Response: simple.Response{StatusCode: 200, Body: resourceQuota},
|
||||
}
|
||||
response, err := c.Setup(t).ResourceQuotas(ns).UpdateStatus(resourceQuota)
|
||||
c.Validate(t, response, err)
|
||||
@@ -176,21 +181,21 @@ func TestResourceQuotaStatusUpdate(t *testing.T) {
|
||||
|
||||
func TestResourceQuotaDelete(t *testing.T) {
|
||||
ns := api.NamespaceDefault
|
||||
c := &testClient{
|
||||
Request: testRequest{Method: "DELETE", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "foo"), Query: buildQueryValues(nil)},
|
||||
Response: Response{StatusCode: 200},
|
||||
c := &simple.Client{
|
||||
Request: simple.Request{Method: "DELETE", Path: testapi.Default.ResourcePath(getResourceQuotasResoureName(), ns, "foo"), Query: simple.BuildQueryValues(nil)},
|
||||
Response: simple.Response{StatusCode: 200},
|
||||
}
|
||||
err := c.Setup(t).ResourceQuotas(ns).Delete("foo")
|
||||
c.Validate(t, nil, err)
|
||||
}
|
||||
|
||||
func TestResourceQuotaWatch(t *testing.T) {
|
||||
c := &testClient{
|
||||
Request: testRequest{
|
||||
c := &simple.Client{
|
||||
Request: simple.Request{
|
||||
Method: "GET",
|
||||
Path: testapi.Default.ResourcePathWithPrefix("watch", getResourceQuotasResoureName(), "", ""),
|
||||
Query: url.Values{"resourceVersion": []string{}}},
|
||||
Response: Response{StatusCode: 200},
|
||||
Response: simple.Response{StatusCode: 200},
|
||||
}
|
||||
_, err := c.Setup(t).ResourceQuotas(api.NamespaceAll).Watch(unversioned.ListOptions{})
|
||||
c.Validate(t, nil, err)
|
||||
|
||||
Reference in New Issue
Block a user