Skip to content

Commit

Permalink
agent: test full object when performing test config parse. (#13668)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasell committed Jul 11, 2022
1 parent f219718 commit d442e1b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions command/agent/config_parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ var basicConfig = &Config{
AutoAdvertise: &trueValue,
ChecksUseAdvertise: &trueValue,
Timeout: 5 * time.Second,
TimeoutHCL: "5s",
},
Vault: &config.VaultConfig{
Addr: "127.0.0.1:9500",
Expand Down Expand Up @@ -420,7 +421,10 @@ func TestConfig_ParseMerge(t *testing.T) {
actual, err := ParseConfigFile(path)
require.NoError(t, err)

require.Equal(t, basicConfig.Client, actual.Client)
// The Vault connection retry interval is an internal only configuration
// option, and therefore needs to be added here to ensure the test passes.
actual.Vault.ConnectionRetryIntv = config.DefaultVaultConnectRetryIntv
require.Equal(t, basicConfig, actual)

oldDefault := &Config{
Consul: config.DefaultConsulConfig(),
Expand All @@ -431,8 +435,7 @@ func TestConfig_ParseMerge(t *testing.T) {
Audit: &config.AuditConfig{},
}
merged := oldDefault.Merge(actual)
require.Equal(t, basicConfig.Client, merged.Client)

require.Equal(t, basicConfig, merged)
}

func TestConfig_Parse(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions command/agent/testdata/basic.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ consul {
client_auto_join = true
auto_advertise = true
checks_use_advertise = true
timeout = "5s"
}

vault {
Expand Down
1 change: 1 addition & 0 deletions command/agent/testdata/basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
"server_serf_check_name": "nomad-server-serf-health-check",
"server_service_name": "nomad",
"ssl": true,
"timeout": "5s",
"token": "token1",
"verify_ssl": true
}
Expand Down

0 comments on commit d442e1b

Please sign in to comment.