kubectl delete resource : remove all resources

This commit is contained in:
Salvatore Dario Minonne
2015-02-12 15:59:58 +01:00
parent c2140228fc
commit fda17c1b7a
7 changed files with 55 additions and 49 deletions

View File

@@ -22,7 +22,6 @@ import (
"strings"
"testing"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
)
@@ -83,37 +82,6 @@ func TestDeleteObjectIgnoreNotFound(t *testing.T) {
}
}
func TestDeleteNoObjects(t *testing.T) {
f, tf, codec := NewAPIFactory()
tf.Printer = &testPrinter{}
tf.Client = &client.FakeRESTClient{
Codec: codec,
Client: client.HTTPClientFunc(func(req *http.Request) (*http.Response, error) {
switch p, m := req.URL.Path, req.Method; {
case p == "/namespaces/test/pods" && m == "GET":
return &http.Response{StatusCode: 200, Body: objBody(codec, &api.PodList{})}, nil
default:
t.Fatalf("unexpected request: %#v\n%#v", req.URL, req)
return nil, nil
}
}),
}
tf.Namespace = "test"
buf := bytes.NewBuffer([]byte{})
stderr := bytes.NewBuffer([]byte{})
cmd := f.NewCmdDelete(buf)
cmd.SetOutput(stderr)
cmd.Run(cmd, []string{"pods"})
if buf.String() != "" {
t.Errorf("unexpected output: %s", buf.String())
}
if stderr.String() != "No resources found\n" {
t.Errorf("unexpected output: %s", stderr.String())
}
}
func TestDeleteMultipleObject(t *testing.T) {
pods, svc := testData()