use record flags

This commit is contained in:
David Eads
2018-04-18 11:20:33 -04:00
parent b523c915e4
commit e2a5c39b23
16 changed files with 244 additions and 139 deletions

View File

@@ -431,8 +431,8 @@ func TestAnnotateErrors(t *testing.T) {
for k, v := range testCase.flags {
cmd.Flags().Set(k, v)
}
options := &AnnotateOptions{}
err := options.Complete(buf, cmd, testCase.args)
options := NewAnnotateOptions(buf)
err := options.Complete(tf, cmd, testCase.args)
if err == nil {
err = options.Validate()
}
@@ -488,9 +488,9 @@ func TestAnnotateObject(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdAnnotate(tf, buf)
cmd.SetOutput(buf)
options := &AnnotateOptions{}
options := NewAnnotateOptions(buf)
args := []string{"pods/foo", "a=b", "c-"}
if err := options.Complete(buf, cmd, args); err != nil {
if err := options.Complete(tf, cmd, args); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if err := options.Validate(); err != nil {
@@ -542,10 +542,10 @@ func TestAnnotateObjectFromFile(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdAnnotate(tf, buf)
cmd.SetOutput(buf)
options := &AnnotateOptions{}
options := NewAnnotateOptions(buf)
options.Filenames = []string{"../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"}
args := []string{"a=b", "c-"}
if err := options.Complete(buf, cmd, args); err != nil {
if err := options.Complete(tf, cmd, args); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if err := options.Validate(); err != nil {
@@ -573,10 +573,11 @@ func TestAnnotateLocal(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdAnnotate(tf, buf)
options := &AnnotateOptions{local: true}
options := NewAnnotateOptions(buf)
options.local = true
options.Filenames = []string{"../../../test/e2e/testing-manifests/statefulset/cassandra/controller.yaml"}
args := []string{"a=b"}
if err := options.Complete(buf, cmd, args); err != nil {
if err := options.Complete(tf, cmd, args); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if err := options.Validate(); err != nil {
@@ -629,9 +630,10 @@ func TestAnnotateMultipleObjects(t *testing.T) {
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdAnnotate(tf, buf)
cmd.SetOutput(buf)
options := &AnnotateOptions{all: true}
options := NewAnnotateOptions(buf)
options.all = true
args := []string{"pods", "a=b", "c-"}
if err := options.Complete(buf, cmd, args); err != nil {
if err := options.Complete(tf, cmd, args); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if err := options.Validate(); err != nil {