Allow resource.Builder commands to take arguments by type/name

Will allow xarg behavior to fetch resources across multiple types.
Changes 'create', 'get', 'update', 'stop', and 'delete' to output
<resourceType>/<name>.
This commit is contained in:
Clayton Coleman
2015-03-25 01:01:07 -04:00
parent a34f39aee4
commit 581d7cd789
16 changed files with 343 additions and 46 deletions

View File

@@ -61,7 +61,7 @@ func TestCreateObject(t *testing.T) {
cmd.Run(cmd, []string{})
// uses the name from the file, not the response
if buf.String() != "redis-master-controller\n" {
if buf.String() != "replicationControllers/redis-master-controller\n" {
t.Errorf("unexpected output: %s", buf.String())
}
}
@@ -94,7 +94,7 @@ func TestCreateMultipleObject(t *testing.T) {
cmd.Run(cmd, []string{})
// Names should come from the REST response, NOT the files
if buf.String() != "rc1\nbaz\n" {
if buf.String() != "replicationControllers/rc1\nservices/baz\n" {
t.Errorf("unexpected output: %s", buf.String())
}
}
@@ -126,7 +126,7 @@ func TestCreateDirectory(t *testing.T) {
cmd.Flags().Set("filename", "../../../examples/guestbook")
cmd.Run(cmd, []string{})
if buf.String() != "name\nbaz\nname\nbaz\nname\nbaz\n" {
if buf.String() != "replicationControllers/name\nservices/baz\nreplicationControllers/name\nservices/baz\nreplicationControllers/name\nservices/baz\n" {
t.Errorf("unexpected output: %s", buf.String())
}
}