Revert "config: rename test struct field to args"
This reverts commit f2a291a4704c9954c441567860ca740ac0f58308.
This commit is contained in:
parent
0f0b510f37
commit
b580f7a533
|
@ -27,7 +27,7 @@ import (
|
|||
|
||||
type configTest struct {
|
||||
desc string
|
||||
args []string
|
||||
flags []string
|
||||
pre, post func()
|
||||
json, jsontail []string
|
||||
hcl, hcltail []string
|
||||
|
@ -56,7 +56,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
|
||||
{
|
||||
desc: "-advertise",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-advertise=1.2.3.4`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -75,7 +75,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-advertise-wan",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-advertise-wan=1.2.3.4`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -91,7 +91,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-advertise and -advertise-wan",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-advertise=1.2.3.4`,
|
||||
`-advertise-wan=5.6.7.8`,
|
||||
`-data-dir=` + dataDir,
|
||||
|
@ -111,7 +111,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-bind",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-bind=1.2.3.4`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -134,7 +134,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-bootstrap",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-bootstrap`,
|
||||
`-server`,
|
||||
`-data-dir=` + dataDir,
|
||||
|
@ -150,7 +150,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-bootstrap-expect",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-bootstrap-expect=3`,
|
||||
`-server`,
|
||||
`-data-dir=` + dataDir,
|
||||
|
@ -166,7 +166,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-client",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-client=1.2.3.4`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -179,21 +179,21 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-data-dir empty",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=`,
|
||||
},
|
||||
err: "data_dir cannot be empty",
|
||||
},
|
||||
{
|
||||
desc: "-data-dir non-directory",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=runtime_test.go`,
|
||||
},
|
||||
err: `data_dir "runtime_test.go" is not a directory`,
|
||||
},
|
||||
{
|
||||
desc: "-datacenter",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -204,7 +204,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-datacenter empty",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -212,7 +212,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-dev",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-dev`,
|
||||
},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -252,7 +252,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-disable-host-node-id",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-disable-host-node-id`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -263,7 +263,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-disable-keyring-file",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-disable-keyring-file`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -274,7 +274,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-dns-port",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-dns-port=123`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -286,7 +286,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-domain",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-domain=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -297,7 +297,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-enable-script-checks",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-enable-script-checks`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -308,7 +308,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-encrypt",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-encrypt=i0P+gFTkLPg0h53eNYjydg==`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -319,7 +319,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-http-port",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-http-port=123`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -331,7 +331,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-join",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-join=a`,
|
||||
`-join=b`,
|
||||
`-data-dir=` + dataDir,
|
||||
|
@ -343,7 +343,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-join-wan",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-join-wan=a`,
|
||||
`-join-wan=b`,
|
||||
`-data-dir=` + dataDir,
|
||||
|
@ -355,7 +355,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-log-level",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-log-level=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -366,7 +366,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-node",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-node=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -377,7 +377,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-node-id",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-node-id=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -388,7 +388,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-node-meta",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-node-meta=a:b`,
|
||||
`-node-meta=c:d`,
|
||||
`-data-dir=` + dataDir,
|
||||
|
@ -400,7 +400,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-non-voting-server",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-non-voting-server`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -411,7 +411,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-pid-file",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-pid-file=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -422,7 +422,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-protocol",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-protocol=1`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -433,7 +433,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-raft-protocol",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-raft-protocol=1`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -444,7 +444,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-recursor",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-recursor=1.2.3.4`,
|
||||
`-recursor=5.6.7.8`,
|
||||
`-data-dir=` + dataDir,
|
||||
|
@ -456,7 +456,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-rejoin",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-rejoin`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -467,7 +467,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-retry-interval",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-retry-interval=5s`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -478,7 +478,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-retry-interval-wan",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-retry-interval-wan=5s`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -489,7 +489,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-retry-join",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-retry-join=a`,
|
||||
`-retry-join=b`,
|
||||
`-data-dir=` + dataDir,
|
||||
|
@ -501,7 +501,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-retry-join-wan",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-retry-join-wan=a`,
|
||||
`-retry-join-wan=b`,
|
||||
`-data-dir=` + dataDir,
|
||||
|
@ -513,7 +513,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-retry-max",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-retry-max=1`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -524,7 +524,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-retry-max-wan",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-retry-max-wan=1`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -535,7 +535,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-serf-lan-bind",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-serf-lan-bind=1.2.3.4`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -546,7 +546,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-serf-wan-bind",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-serf-wan-bind=1.2.3.4`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -557,7 +557,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-server",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-server`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -570,7 +570,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-syslog",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-syslog`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -581,7 +581,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-ui",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-ui`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -592,7 +592,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "-ui-dir",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-ui-dir=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -608,7 +608,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
|
||||
{
|
||||
desc: "bind addr any v4",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr":"0.0.0.0" }`},
|
||||
hcl: []string{`bind_addr = "0.0.0.0"`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -630,7 +630,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "bind addr any v6",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr":"::" }`},
|
||||
hcl: []string{`bind_addr = "::"`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -655,7 +655,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "bind addr any and advertise set should not detect",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr":"0.0.0.0", "advertise_addr": "1.2.3.4" }`},
|
||||
hcl: []string{`bind_addr = "0.0.0.0" advertise_addr = "1.2.3.4"`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -680,7 +680,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "client addr and ports == 0",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{
|
||||
"client_addr":"0.0.0.0",
|
||||
"ports":{}
|
||||
|
@ -698,7 +698,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "client addr and ports < 0",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{
|
||||
"client_addr":"0.0.0.0",
|
||||
"ports": { "dns":-1, "http":-2, "https":-3 }
|
||||
|
@ -718,7 +718,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "client addr and ports > 0",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{
|
||||
"client_addr":"0.0.0.0",
|
||||
"ports":{ "dns": 1, "http": 2, "https": 3 }
|
||||
|
@ -741,7 +741,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
|
||||
{
|
||||
desc: "client addr, addresses and ports == 0",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{
|
||||
"client_addr":"0.0.0.0",
|
||||
"addresses": { "dns": "1.1.1.1", "http": "2.2.2.2", "https": "3.3.3.3" },
|
||||
|
@ -761,7 +761,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "client addr, addresses and ports < 0",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{
|
||||
"client_addr":"0.0.0.0",
|
||||
"addresses": { "dns": "1.1.1.1", "http": "2.2.2.2", "https": "3.3.3.3" },
|
||||
|
@ -783,7 +783,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "client addr, addresses and ports",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{
|
||||
"client_addr": "0.0.0.0",
|
||||
"addresses": { "dns": "1.1.1.1", "http": "2.2.2.2", "https": "3.3.3.3" },
|
||||
|
@ -807,7 +807,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "client template and ports",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{
|
||||
"client_addr": "{{ printf \"1.2.3.4 2001:db8::1\" }}",
|
||||
"ports":{ "dns":1, "http":2, "https":3 }
|
||||
|
@ -829,7 +829,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "client, address template and ports",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{
|
||||
"client_addr": "{{ printf \"1.2.3.4 2001:db8::1\" }}",
|
||||
"addresses": {
|
||||
|
@ -861,7 +861,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise address lan template",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "advertise_addr": "{{ printf \"1.2.3.4\" }}" }`},
|
||||
hcl: []string{`advertise_addr = "{{ printf \"1.2.3.4\" }}"`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -879,7 +879,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise address wan template",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "advertise_addr_wan": "{{ printf \"1.2.3.4\" }}" }`},
|
||||
hcl: []string{`advertise_addr_wan = "{{ printf \"1.2.3.4\" }}"`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -894,7 +894,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise address lan with ports",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{
|
||||
"ports": {
|
||||
"server": 1000,
|
||||
|
@ -932,7 +932,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise address wan with ports",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{
|
||||
"ports": {
|
||||
"server": 1000,
|
||||
|
@ -970,7 +970,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "serf bind address lan template",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "serf_lan": "{{ printf \"1.2.3.4\" }}" }`},
|
||||
hcl: []string{`serf_lan = "{{ printf \"1.2.3.4\" }}"`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -980,7 +980,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "serf bind address wan template",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "serf_wan": "{{ printf \"1.2.3.4\" }}" }`},
|
||||
hcl: []string{`serf_wan = "{{ printf \"1.2.3.4\" }}"`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -990,7 +990,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "dns recursor templates with deduplication",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "recursors": [ "{{ printf \"5.6.7.8:9999\" }}", "{{ printf \"1.2.3.4\" }}", "{{ printf \"5.6.7.8:9999\" }}" ] }`},
|
||||
hcl: []string{`recursors = [ "{{ printf \"5.6.7.8:9999\" }}", "{{ printf \"1.2.3.4\" }}", "{{ printf \"5.6.7.8:9999\" }}" ] `},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -1005,7 +1005,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
|
||||
{
|
||||
desc: "precedence: merge order",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{
|
||||
`{
|
||||
"bootstrap": true,
|
||||
|
@ -1077,7 +1077,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
start_join = ["a", "b"]
|
||||
`,
|
||||
},
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-advertise=1.1.1.1`,
|
||||
`-advertise-wan=2.2.2.2`,
|
||||
`-bootstrap=false`,
|
||||
|
@ -1115,7 +1115,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
//
|
||||
{
|
||||
desc: "raft performance scaling",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "performance": { "raft_multiplier": 9} }`},
|
||||
hcl: []string{`performance = { raft_multiplier=9 }`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -1132,14 +1132,14 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
|
||||
{
|
||||
desc: "invalid input",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`this is not JSON`},
|
||||
hcl: []string{`*** 0123 this is not HCL`},
|
||||
err: "Error parsing",
|
||||
},
|
||||
{
|
||||
desc: "datacenter is lower-cased",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "datacenter": "A" }`},
|
||||
hcl: []string{`datacenter = "A"`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -1149,7 +1149,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "acl_datacenter is lower-cased",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "acl_datacenter": "A" }`},
|
||||
hcl: []string{`acl_datacenter = "A"`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -1159,7 +1159,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "acl_replication_token enables acl replication",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "acl_replication_token": "a" }`},
|
||||
hcl: []string{`acl_replication_token = "a"`},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
|
@ -1170,7 +1170,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise address detect fails v4",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr": "0.0.0.0"}`},
|
||||
hcl: []string{`bind_addr = "0.0.0.0"`},
|
||||
privatev4: func() ([]*net.IPAddr, error) {
|
||||
|
@ -1180,7 +1180,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise address detect none v4",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr": "0.0.0.0"}`},
|
||||
hcl: []string{`bind_addr = "0.0.0.0"`},
|
||||
privatev4: func() ([]*net.IPAddr, error) {
|
||||
|
@ -1190,7 +1190,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise address detect multiple v4",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr": "0.0.0.0"}`},
|
||||
hcl: []string{`bind_addr = "0.0.0.0"`},
|
||||
privatev4: func() ([]*net.IPAddr, error) {
|
||||
|
@ -1200,7 +1200,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise address detect fails v6",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr": "::"}`},
|
||||
hcl: []string{`bind_addr = "::"`},
|
||||
publicv6: func() ([]*net.IPAddr, error) {
|
||||
|
@ -1210,7 +1210,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise address detect none v6",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr": "::"}`},
|
||||
hcl: []string{`bind_addr = "::"`},
|
||||
publicv6: func() ([]*net.IPAddr, error) {
|
||||
|
@ -1220,7 +1220,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise address detect multiple v6",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr": "::"}`},
|
||||
hcl: []string{`bind_addr = "::"`},
|
||||
publicv6: func() ([]*net.IPAddr, error) {
|
||||
|
@ -1230,21 +1230,21 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "ae_interval invalid == 0",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
jsontail: []string{`{ "ae_interval": "0s" }`},
|
||||
hcltail: []string{`ae_interval = "0s"`},
|
||||
err: `ae_interval cannot be 0s. Must be positive`,
|
||||
},
|
||||
{
|
||||
desc: "ae_interval invalid < 0",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
jsontail: []string{`{ "ae_interval": "-1s" }`},
|
||||
hcltail: []string{`ae_interval = "-1s"`},
|
||||
err: `ae_interval cannot be -1s. Must be positive`,
|
||||
},
|
||||
{
|
||||
desc: "acl_datacenter invalid",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -1254,7 +1254,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "autopilot.max_trailing_logs invalid",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -1264,28 +1264,28 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "bind_addr cannot be empty",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr": "" }`},
|
||||
hcl: []string{`bind_addr = ""`},
|
||||
err: "bind_addr cannot be empty",
|
||||
},
|
||||
{
|
||||
desc: "bind_addr does not allow multiple addresses",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr": "1.1.1.1 2.2.2.2" }`},
|
||||
hcl: []string{`bind_addr = "1.1.1.1 2.2.2.2"`},
|
||||
err: "bind_addr cannot contain multiple addresses",
|
||||
},
|
||||
{
|
||||
desc: "bind_addr cannot be a unix socket",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "bind_addr": "unix:///foo" }`},
|
||||
hcl: []string{`bind_addr = "unix:///foo"`},
|
||||
err: "bind_addr cannot be a unix socket",
|
||||
},
|
||||
{
|
||||
desc: "bootstrap without server",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -1295,7 +1295,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "bootstrap-expect without server",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -1305,7 +1305,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "bootstrap-expect invalid",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -1315,7 +1315,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "bootstrap-expect and dev mode",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-dev`,
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
|
@ -1326,7 +1326,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "bootstrap-expect and bootstrap",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -1336,7 +1336,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "bootstrap-expect=1 equals bootstrap",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "bootstrap_expect": 1, "server": true }`},
|
||||
|
@ -1353,7 +1353,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "bootstrap-expect=2 warning",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "bootstrap_expect": 2, "server": true }`},
|
||||
|
@ -1372,7 +1372,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "bootstrap-expect > 2 but even warning",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "bootstrap_expect": 4, "server": true }`},
|
||||
|
@ -1391,7 +1391,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "client mode sets LeaveOnTerm and SkipLeaveOnInt correctly",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "server": false }`},
|
||||
|
@ -1405,7 +1405,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "client does not allow socket",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -1415,14 +1415,14 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "datacenter invalid",
|
||||
args: []string{`-data-dir=` + dataDir},
|
||||
flags: []string{`-data-dir=` + dataDir},
|
||||
json: []string{`{ "datacenter": "%" }`},
|
||||
hcl: []string{`datacenter = "%"`},
|
||||
err: `datacenter cannot be "%". Please use only [a-z0-9-_]`,
|
||||
},
|
||||
{
|
||||
desc: "dns does not allow socket",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -1432,7 +1432,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "ui and ui_dir",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-datacenter=a`,
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
|
@ -1447,7 +1447,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
// to avoid combinatory explosion for tests use 0.0.0.0, :: or [::] but not all of them
|
||||
{
|
||||
desc: "advertise_addr any",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "advertise_addr": "0.0.0.0" }`},
|
||||
|
@ -1456,7 +1456,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "advertise_addr_wan any",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "advertise_addr_wan": "::" }`},
|
||||
|
@ -1465,7 +1465,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "recursors any",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "recursors": ["::"] }`},
|
||||
|
@ -1474,7 +1474,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "dns_config.udp_answer_limit invalid",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "dns_config": { "udp_answer_limit": -1 } }`},
|
||||
|
@ -1483,7 +1483,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "performance.raft_multiplier < 0",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "performance": { "raft_multiplier": -1 } }`},
|
||||
|
@ -1492,7 +1492,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "performance.raft_multiplier == 0",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "performance": { "raft_multiplier": 0 } }`},
|
||||
|
@ -1501,7 +1501,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "performance.raft_multiplier > 10",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "performance": { "raft_multiplier": 20 } }`},
|
||||
|
@ -1510,7 +1510,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "node_name invalid",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
`-node=`,
|
||||
},
|
||||
|
@ -1519,7 +1519,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "node_meta key too long",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{
|
||||
|
@ -1534,7 +1534,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "node_meta value too long",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{
|
||||
|
@ -1549,7 +1549,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "node_meta too many keys",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{
|
||||
|
@ -1564,7 +1564,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "unique listeners dns vs http",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{
|
||||
|
@ -1579,7 +1579,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "unique listeners dns vs https",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{
|
||||
|
@ -1594,7 +1594,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "unique listeners http vs https",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{
|
||||
|
@ -1609,7 +1609,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "unique advertise addresses HTTP vs RPC",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{
|
||||
|
@ -1624,7 +1624,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "unique advertise addresses RPC vs Serf LAN",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{
|
||||
|
@ -1637,7 +1637,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "unique advertise addresses RPC vs Serf WAN",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{
|
||||
|
@ -1650,7 +1650,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "telemetry.prefix_filter cannot be empty",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{
|
||||
|
@ -1666,7 +1666,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "telemetry.prefix_filter must start with + or -",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{
|
||||
|
@ -1684,7 +1684,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "telemetry.enable_deprecated_names adds allow rule for whitelist",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{
|
||||
|
@ -1702,7 +1702,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "encrypt has invalid key",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "encrypt": "this is not a valid key" }`},
|
||||
|
@ -1711,7 +1711,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "encrypt given but LAN keyring exists",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "encrypt": "i0P+gFTkLPg0h53eNYjydg==" }`},
|
||||
|
@ -1730,7 +1730,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "encrypt given but WAN keyring exists",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "encrypt": "i0P+gFTkLPg0h53eNYjydg==", "server": true }`},
|
||||
|
@ -1752,7 +1752,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "multiple check files",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{
|
||||
|
@ -1773,7 +1773,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "multiple service files",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{
|
||||
|
@ -1794,7 +1794,7 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "translated keys",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{
|
||||
|
@ -1886,7 +1886,7 @@ func testConfig(t *testing.T, tests []configTest, dataDir string) {
|
|||
|
||||
t.Run(strings.Join(desc, ":"), func(t *testing.T) {
|
||||
// first parse the flags
|
||||
flags, err := ParseFlags(tt.args)
|
||||
flags, err := ParseFlags(tt.flags)
|
||||
if err != nil {
|
||||
t.Fatalf("ParseFlags failed: %s", err)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ func TestSegments(t *testing.T) {
|
|||
tests := []configTest{
|
||||
{
|
||||
desc: "segment name not in OSS",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "server": true, "segment": "a" }`},
|
||||
|
@ -25,7 +25,7 @@ func TestSegments(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "segment port must be set",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "segments":[{ "name":"x" }] }`},
|
||||
|
@ -34,7 +34,7 @@ func TestSegments(t *testing.T) {
|
|||
},
|
||||
{
|
||||
desc: "segments not in OSS",
|
||||
args: []string{
|
||||
flags: []string{
|
||||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{`{ "segments":[{ "name":"x", "port": 123 }] }`},
|
||||
|
|
Loading…
Reference in New Issue