|
|
@@ -26,6 +26,10 @@ func Test_parseWatchArgs(t *testing.T) {
|
|
|
envKey, envRange string
|
|
|
interactive bool
|
|
|
|
|
|
+ interactiveWatchPrefix bool
|
|
|
+ interactiveWatchRev int64
|
|
|
+ interactiveWatchPrevKey bool
|
|
|
+
|
|
|
watchArgs []string
|
|
|
execArgs []string
|
|
|
err error
|
|
|
@@ -145,6 +149,14 @@ func Test_parseWatchArgs(t *testing.T) {
|
|
|
execArgs: []string{"echo", "Hello", "World"},
|
|
|
err: nil,
|
|
|
},
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "foo", "--", "echo", "watch", "event", "received"},
|
|
|
+ commandArgs: []string{"foo", "echo", "watch", "event", "received"},
|
|
|
+ interactive: false,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: []string{"echo", "watch", "event", "received"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
{
|
|
|
osArgs: []string{"./bin/etcdctl", "watch", "foo", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
commandArgs: []string{"foo", "echo", "Hello", "World"},
|
|
|
@@ -153,6 +165,22 @@ func Test_parseWatchArgs(t *testing.T) {
|
|
|
execArgs: []string{"echo", "Hello", "World"},
|
|
|
err: nil,
|
|
|
},
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "foo", "--rev", "1", "--", "echo", "watch", "event", "received"},
|
|
|
+ commandArgs: []string{"foo", "echo", "watch", "event", "received"},
|
|
|
+ interactive: false,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: []string{"echo", "watch", "event", "received"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "--rev", "1", "foo", "--", "echo", "watch", "event", "received"},
|
|
|
+ commandArgs: []string{"foo", "echo", "watch", "event", "received"},
|
|
|
+ interactive: false,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: []string{"echo", "watch", "event", "received"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
{
|
|
|
osArgs: []string{"./bin/etcdctl", "watch", "foo", "bar", "--", "echo", "Hello", "World"},
|
|
|
commandArgs: []string{"foo", "bar", "echo", "Hello", "World"},
|
|
|
@@ -186,162 +214,322 @@ func Test_parseWatchArgs(t *testing.T) {
|
|
|
err: nil,
|
|
|
},
|
|
|
{
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
- commandArgs: []string{"echo", "Hello", "World"},
|
|
|
- envKey: "foo",
|
|
|
- envRange: "",
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "foo", "bar", "--rev", "1", "--", "echo", "watch", "event", "received"},
|
|
|
+ commandArgs: []string{"foo", "bar", "echo", "watch", "event", "received"},
|
|
|
interactive: false,
|
|
|
- watchArgs: []string{"foo"},
|
|
|
- execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: []string{"echo", "watch", "event", "received"},
|
|
|
err: nil,
|
|
|
},
|
|
|
{
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
- commandArgs: []string{"echo", "Hello", "World"},
|
|
|
- envKey: "foo",
|
|
|
- envRange: "bar",
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "foo", "--rev", "1", "bar", "--", "echo", "Hello", "World"},
|
|
|
+ commandArgs: []string{"foo", "bar", "echo", "Hello", "World"},
|
|
|
interactive: false,
|
|
|
watchArgs: []string{"foo", "bar"},
|
|
|
execArgs: []string{"echo", "Hello", "World"},
|
|
|
err: nil,
|
|
|
},
|
|
|
{
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "foo", "bar", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "--rev", "1", "foo", "bar", "--", "echo", "Hello", "World"},
|
|
|
commandArgs: []string{"foo", "bar", "echo", "Hello", "World"},
|
|
|
- envKey: "foo",
|
|
|
interactive: false,
|
|
|
- watchArgs: nil,
|
|
|
- execArgs: nil,
|
|
|
- err: errBadArgsNumConflictEnv,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"foo", "bar", "--", "echo", "Hello", "World"},
|
|
|
- interactive: true,
|
|
|
- watchArgs: nil,
|
|
|
- execArgs: nil,
|
|
|
- err: errBadArgsInteractiveWatch,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "foo"},
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"foo"},
|
|
|
- execArgs: nil,
|
|
|
- err: nil,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "foo", "bar"},
|
|
|
- interactive: true,
|
|
|
watchArgs: []string{"foo", "bar"},
|
|
|
- execArgs: nil,
|
|
|
- err: nil,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch"},
|
|
|
- envKey: "foo",
|
|
|
- envRange: "bar",
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"foo", "bar"},
|
|
|
- execArgs: nil,
|
|
|
- err: nil,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch"},
|
|
|
- envKey: "hello world!",
|
|
|
- envRange: "bar",
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"hello world!", "bar"},
|
|
|
- execArgs: nil,
|
|
|
- err: nil,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "foo", "--rev", "1"},
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"foo"},
|
|
|
- execArgs: nil,
|
|
|
- err: nil,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "foo", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"foo"},
|
|
|
execArgs: []string{"echo", "Hello", "World"},
|
|
|
err: nil,
|
|
|
},
|
|
|
{
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "--rev", "1", "foo", "--", "echo", "Hello", "World"},
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"foo"},
|
|
|
- execArgs: []string{"echo", "Hello", "World"},
|
|
|
- err: nil,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "--", "echo", "Hello", "World"},
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
+ commandArgs: []string{"echo", "Hello", "World"},
|
|
|
envKey: "foo",
|
|
|
- interactive: true,
|
|
|
+ envRange: "",
|
|
|
+ interactive: false,
|
|
|
watchArgs: []string{"foo"},
|
|
|
execArgs: []string{"echo", "Hello", "World"},
|
|
|
err: nil,
|
|
|
},
|
|
|
{
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "--", "echo", "Hello", "World"},
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
+ commandArgs: []string{"echo", "Hello", "World"},
|
|
|
envKey: "foo",
|
|
|
envRange: "bar",
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"foo", "bar"},
|
|
|
- execArgs: []string{"echo", "Hello", "World"},
|
|
|
- err: nil,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "foo", "bar", "--", "echo", "Hello", "World"},
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"foo", "bar"},
|
|
|
- execArgs: []string{"echo", "Hello", "World"},
|
|
|
- err: nil,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "--rev", "1", "foo", "bar", "--", "echo", "Hello", "World"},
|
|
|
- interactive: true,
|
|
|
+ interactive: false,
|
|
|
watchArgs: []string{"foo", "bar"},
|
|
|
execArgs: []string{"echo", "Hello", "World"},
|
|
|
err: nil,
|
|
|
},
|
|
|
{
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "foo", "bar", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
+ commandArgs: []string{"foo", "bar", "echo", "Hello", "World"},
|
|
|
envKey: "foo",
|
|
|
- envRange: "bar",
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"foo", "bar"},
|
|
|
- execArgs: []string{"echo", "Hello", "World"},
|
|
|
- err: nil,
|
|
|
- },
|
|
|
- {
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "foo", "--rev", "1", "bar", "--", "echo", "Hello", "World"},
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"foo", "bar"},
|
|
|
- execArgs: []string{"echo", "Hello", "World"},
|
|
|
- err: nil,
|
|
|
+ interactive: false,
|
|
|
+ watchArgs: nil,
|
|
|
+ execArgs: nil,
|
|
|
+ err: errBadArgsNumConflictEnv,
|
|
|
},
|
|
|
{
|
|
|
- osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
- commandArgs: []string{"watch", "foo", "bar", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
- interactive: true,
|
|
|
- watchArgs: []string{"foo", "bar"},
|
|
|
- execArgs: []string{"echo", "Hello", "World"},
|
|
|
- err: nil,
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"foo", "bar", "--", "echo", "Hello", "World"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 0,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: nil,
|
|
|
+ execArgs: nil,
|
|
|
+ err: errBadArgsInteractiveWatch,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "foo"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 0,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: nil,
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "foo", "bar"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 0,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: nil,
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch"},
|
|
|
+ envKey: "foo",
|
|
|
+ envRange: "bar",
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 0,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: nil,
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch"},
|
|
|
+ envKey: "hello world!",
|
|
|
+ envRange: "bar",
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 0,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"hello world!", "bar"},
|
|
|
+ execArgs: nil,
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "foo", "--rev", "1"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 1,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: nil,
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "foo", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 1,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--rev", "1", "foo", "--", "echo", "Hello", "World"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 1,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--rev", "5", "--prev-kv", "foo", "--", "echo", "Hello", "World"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 5,
|
|
|
+ interactiveWatchPrevKey: true,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--rev", "1"},
|
|
|
+ envKey: "foo",
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 1,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: nil,
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--rev", "1"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 0,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: nil,
|
|
|
+ execArgs: nil,
|
|
|
+ err: errBadArgsNum,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--rev", "1", "--prefix"},
|
|
|
+ envKey: "foo",
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: true,
|
|
|
+ interactiveWatchRev: 1,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: nil,
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--rev", "100", "--prefix", "--prev-kv"},
|
|
|
+ envKey: "foo",
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: true,
|
|
|
+ interactiveWatchRev: 100,
|
|
|
+ interactiveWatchPrevKey: true,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: nil,
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--rev", "1", "--prefix"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 0,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: nil,
|
|
|
+ execArgs: nil,
|
|
|
+ err: errBadArgsNum,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--", "echo", "Hello", "World"},
|
|
|
+ envKey: "foo",
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 0,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--", "echo", "Hello", "World"},
|
|
|
+ envKey: "foo",
|
|
|
+ envRange: "bar",
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 0,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "foo", "bar", "--", "echo", "Hello", "World"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 0,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--rev", "1", "foo", "bar", "--", "echo", "Hello", "World"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 1,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
+ envKey: "foo",
|
|
|
+ envRange: "bar",
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 1,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "foo", "--rev", "1", "bar", "--", "echo", "Hello", "World"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 1,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "foo", "bar", "--rev", "1", "--", "echo", "Hello", "World"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: false,
|
|
|
+ interactiveWatchRev: 1,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "foo", "bar", "--rev", "7", "--prefix", "--", "echo", "Hello", "World"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: true,
|
|
|
+ interactiveWatchRev: 7,
|
|
|
+ interactiveWatchPrevKey: false,
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ osArgs: []string{"./bin/etcdctl", "watch", "-i"},
|
|
|
+ commandArgs: []string{"watch", "foo", "bar", "--rev", "7", "--prefix", "--prev-kv", "--", "echo", "Hello", "World"},
|
|
|
+ interactive: true,
|
|
|
+ interactiveWatchPrefix: true,
|
|
|
+ interactiveWatchRev: 7,
|
|
|
+ interactiveWatchPrevKey: true,
|
|
|
+ watchArgs: []string{"foo", "bar"},
|
|
|
+ execArgs: []string{"echo", "Hello", "World"},
|
|
|
+ err: nil,
|
|
|
},
|
|
|
}
|
|
|
for i, ts := range tt {
|
|
|
@@ -355,5 +543,16 @@ func Test_parseWatchArgs(t *testing.T) {
|
|
|
if !reflect.DeepEqual(execArgs, ts.execArgs) {
|
|
|
t.Fatalf("#%d: execArgs expected %q, got %v", i, ts.execArgs, execArgs)
|
|
|
}
|
|
|
+ if ts.interactive {
|
|
|
+ if ts.interactiveWatchPrefix != watchPrefix {
|
|
|
+ t.Fatalf("#%d: interactive watchPrefix expected %v, got %v", i, ts.interactiveWatchPrefix, watchPrefix)
|
|
|
+ }
|
|
|
+ if ts.interactiveWatchRev != watchRev {
|
|
|
+ t.Fatalf("#%d: interactive watchRev expected %d, got %d", i, ts.interactiveWatchRev, watchRev)
|
|
|
+ }
|
|
|
+ if ts.interactiveWatchPrevKey != watchPrevKey {
|
|
|
+ t.Fatalf("#%d: interactive watchPrevKey expected %v, got %v", i, ts.interactiveWatchPrevKey, watchPrevKey)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|