Use single string to define a flag allowing for easier testing
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
@ -30,114 +30,72 @@ func TestEtcdServerProcessConfig(t *testing.T) {
|
||||
name: "Default",
|
||||
config: NewConfig(),
|
||||
expectArgs: []string{
|
||||
"--name",
|
||||
"TestEtcdServerProcessConfigDefault-test-0",
|
||||
"--listen-client-urls",
|
||||
"http://localhost:0",
|
||||
"--advertise-client-urls",
|
||||
"http://localhost:0",
|
||||
"--listen-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-advertise-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-cluster-token",
|
||||
"new",
|
||||
"--data-dir",
|
||||
"/tmp/fake/member-0",
|
||||
"--snapshot-count",
|
||||
"10000",
|
||||
"--name=TestEtcdServerProcessConfigDefault-test-0",
|
||||
"--listen-client-urls=http://localhost:0",
|
||||
"--advertise-client-urls=http://localhost:0",
|
||||
"--listen-peer-urls=http://localhost:1",
|
||||
"--initial-advertise-peer-urls=http://localhost:1",
|
||||
"--initial-cluster-token=new",
|
||||
"--data-dir=/tmp/fake/member-0",
|
||||
"--snapshot-count=10000",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "SnapshotCount",
|
||||
config: NewConfig(WithSnapshotCount(42)),
|
||||
expectArgs: []string{
|
||||
"--name",
|
||||
"TestEtcdServerProcessConfigSnapshotCount-test-0",
|
||||
"--listen-client-urls",
|
||||
"http://localhost:0",
|
||||
"--advertise-client-urls",
|
||||
"http://localhost:0",
|
||||
"--listen-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-advertise-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-cluster-token",
|
||||
"new",
|
||||
"--data-dir",
|
||||
"/tmp/fake/member-0",
|
||||
"--snapshot-count",
|
||||
"42",
|
||||
"--name=TestEtcdServerProcessConfigSnapshotCount-test-0",
|
||||
"--listen-client-urls=http://localhost:0",
|
||||
"--advertise-client-urls=http://localhost:0",
|
||||
"--listen-peer-urls=http://localhost:1",
|
||||
"--initial-advertise-peer-urls=http://localhost:1",
|
||||
"--initial-cluster-token=new",
|
||||
"--data-dir=/tmp/fake/member-0",
|
||||
"--snapshot-count=42",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "SnapshotCatchUpEntries",
|
||||
config: NewConfig(WithSnapshotCatchUpEntries(12)),
|
||||
expectArgs: []string{
|
||||
"--name",
|
||||
"TestEtcdServerProcessConfigSnapshotCatchUpEntries-test-0",
|
||||
"--listen-client-urls",
|
||||
"http://localhost:0",
|
||||
"--advertise-client-urls",
|
||||
"http://localhost:0",
|
||||
"--listen-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-advertise-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-cluster-token",
|
||||
"new",
|
||||
"--data-dir",
|
||||
"/tmp/fake/member-0",
|
||||
"--snapshot-count",
|
||||
"10000",
|
||||
"--experimental-snapshot-catchup-entries",
|
||||
"12",
|
||||
"--name=TestEtcdServerProcessConfigSnapshotCatchUpEntries-test-0",
|
||||
"--listen-client-urls=http://localhost:0",
|
||||
"--advertise-client-urls=http://localhost:0",
|
||||
"--listen-peer-urls=http://localhost:1",
|
||||
"--initial-advertise-peer-urls=http://localhost:1",
|
||||
"--initial-cluster-token=new",
|
||||
"--data-dir=/tmp/fake/member-0",
|
||||
"--snapshot-count=10000",
|
||||
"--experimental-snapshot-catchup-entries=12",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "QuotaBackendBytes",
|
||||
config: NewConfig(WithQuotaBackendBytes(123)),
|
||||
expectArgs: []string{
|
||||
"--name",
|
||||
"TestEtcdServerProcessConfigQuotaBackendBytes-test-0",
|
||||
"--listen-client-urls",
|
||||
"http://localhost:0",
|
||||
"--advertise-client-urls",
|
||||
"http://localhost:0",
|
||||
"--listen-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-advertise-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-cluster-token",
|
||||
"new",
|
||||
"--data-dir",
|
||||
"/tmp/fake/member-0",
|
||||
"--snapshot-count",
|
||||
"10000",
|
||||
"--quota-backend-bytes",
|
||||
"123",
|
||||
"--name=TestEtcdServerProcessConfigQuotaBackendBytes-test-0",
|
||||
"--listen-client-urls=http://localhost:0",
|
||||
"--advertise-client-urls=http://localhost:0",
|
||||
"--listen-peer-urls=http://localhost:1",
|
||||
"--initial-advertise-peer-urls=http://localhost:1",
|
||||
"--initial-cluster-token=new",
|
||||
"--data-dir=/tmp/fake/member-0",
|
||||
"--snapshot-count=10000",
|
||||
"--quota-backend-bytes=123",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "CorruptCheck",
|
||||
config: NewConfig(WithInitialCorruptCheck(true)),
|
||||
expectArgs: []string{
|
||||
"--name",
|
||||
"TestEtcdServerProcessConfigCorruptCheck-test-0",
|
||||
"--listen-client-urls",
|
||||
"http://localhost:0",
|
||||
"--advertise-client-urls",
|
||||
"http://localhost:0",
|
||||
"--listen-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-advertise-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-cluster-token",
|
||||
"new",
|
||||
"--data-dir",
|
||||
"/tmp/fake/member-0",
|
||||
"--snapshot-count",
|
||||
"10000",
|
||||
"--name=TestEtcdServerProcessConfigCorruptCheck-test-0",
|
||||
"--listen-client-urls=http://localhost:0",
|
||||
"--advertise-client-urls=http://localhost:0",
|
||||
"--listen-peer-urls=http://localhost:1",
|
||||
"--initial-advertise-peer-urls=http://localhost:1",
|
||||
"--initial-cluster-token=new",
|
||||
"--data-dir=/tmp/fake/member-0",
|
||||
"--snapshot-count=10000",
|
||||
"--experimental-initial-corrupt-check",
|
||||
},
|
||||
},
|
||||
@ -145,22 +103,14 @@ func TestEtcdServerProcessConfig(t *testing.T) {
|
||||
name: "StrictReconfigCheck",
|
||||
config: NewConfig(WithStrictReconfigCheck(false)),
|
||||
expectArgs: []string{
|
||||
"--name",
|
||||
"TestEtcdServerProcessConfigStrictReconfigCheck-test-0",
|
||||
"--listen-client-urls",
|
||||
"http://localhost:0",
|
||||
"--advertise-client-urls",
|
||||
"http://localhost:0",
|
||||
"--listen-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-advertise-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-cluster-token",
|
||||
"new",
|
||||
"--data-dir",
|
||||
"/tmp/fake/member-0",
|
||||
"--snapshot-count",
|
||||
"10000",
|
||||
"--name=TestEtcdServerProcessConfigStrictReconfigCheck-test-0",
|
||||
"--listen-client-urls=http://localhost:0",
|
||||
"--advertise-client-urls=http://localhost:0",
|
||||
"--listen-peer-urls=http://localhost:1",
|
||||
"--initial-advertise-peer-urls=http://localhost:1",
|
||||
"--initial-cluster-token=new",
|
||||
"--data-dir=/tmp/fake/member-0",
|
||||
"--snapshot-count=10000",
|
||||
"--strict-reconfig-check=false",
|
||||
},
|
||||
},
|
||||
@ -168,46 +118,29 @@ func TestEtcdServerProcessConfig(t *testing.T) {
|
||||
name: "CatchUpEntries",
|
||||
config: NewConfig(WithSnapshotCatchUpEntries(100)),
|
||||
expectArgs: []string{
|
||||
"--name",
|
||||
"TestEtcdServerProcessConfigCatchUpEntries-test-0",
|
||||
"--listen-client-urls",
|
||||
"http://localhost:0",
|
||||
"--advertise-client-urls",
|
||||
"http://localhost:0",
|
||||
"--listen-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-advertise-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-cluster-token",
|
||||
"new",
|
||||
"--data-dir",
|
||||
"/tmp/fake/member-0",
|
||||
"--snapshot-count",
|
||||
"10000",
|
||||
"--experimental-snapshot-catchup-entries",
|
||||
"100",
|
||||
"--name=TestEtcdServerProcessConfigCatchUpEntries-test-0",
|
||||
"--listen-client-urls=http://localhost:0",
|
||||
"--advertise-client-urls=http://localhost:0",
|
||||
"--listen-peer-urls=http://localhost:1",
|
||||
"--initial-advertise-peer-urls=http://localhost:1",
|
||||
"--initial-cluster-token=new",
|
||||
"--data-dir=/tmp/fake/member-0",
|
||||
"--snapshot-count=10000",
|
||||
"--experimental-snapshot-catchup-entries=100",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "CatchUpEntriesLastVersion",
|
||||
config: NewConfig(WithSnapshotCatchUpEntries(100), WithVersion(LastVersion)),
|
||||
expectArgs: []string{
|
||||
"--name",
|
||||
"TestEtcdServerProcessConfigCatchUpEntriesLastVersion-test-0",
|
||||
"--listen-client-urls",
|
||||
"http://localhost:0",
|
||||
"--advertise-client-urls",
|
||||
"http://localhost:0",
|
||||
"--listen-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-advertise-peer-urls",
|
||||
"http://localhost:1",
|
||||
"--initial-cluster-token",
|
||||
"new",
|
||||
"--data-dir",
|
||||
"/tmp/fake/member-0",
|
||||
"--snapshot-count",
|
||||
"10000",
|
||||
"--name=TestEtcdServerProcessConfigCatchUpEntriesLastVersion-test-0",
|
||||
"--listen-client-urls=http://localhost:0",
|
||||
"--advertise-client-urls=http://localhost:0",
|
||||
"--listen-peer-urls=http://localhost:1",
|
||||
"--initial-advertise-peer-urls=http://localhost:1",
|
||||
"--initial-cluster-token=new",
|
||||
"--data-dir=/tmp/fake/member-0",
|
||||
"--snapshot-count=10000",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user