mirror of
https://github.com/status-im/consul.git
synced 2025-01-22 11:40:06 +00:00
Fix test failures
Tests only specified one of the fields, but in production we copy the value from a single place, so we can do the same in tests. The AutoConfig test broke because of the problem noticed in a previous commit. The DisabledTTL is not wired up properly so it reports 0s here. Changed the test to use an explicit value.
This commit is contained in:
parent
17841248dd
commit
abd2e160f9
@ -153,6 +153,8 @@ func TestAutoConfigInitialConfiguration(t *testing.T) {
|
||||
}
|
||||
c.AutoConfigAuthzAllowReuse = true
|
||||
|
||||
c.ACLResolverSettings.ACLDisabledTTL = 12 * time.Second
|
||||
|
||||
cafile := path.Join(c.DataDir, "cacert.pem")
|
||||
err := ioutil.WriteFile(cafile, []byte(cacert), 0600)
|
||||
require.NoError(t, err)
|
||||
@ -263,7 +265,7 @@ func TestAutoConfigInitialConfiguration(t *testing.T) {
|
||||
PolicyTTL: "30s",
|
||||
TokenTTL: "30s",
|
||||
RoleTTL: "30s",
|
||||
DisabledTTL: "0s",
|
||||
DisabledTTL: "12s",
|
||||
DownPolicy: "extend-cache",
|
||||
DefaultPolicy: "deny",
|
||||
Tokens: &pbconfig.ACLTokens{
|
||||
|
@ -245,6 +245,12 @@ func testServerWithConfig(t *testing.T, cb func(*Config)) (string, *Server) {
|
||||
cb(config)
|
||||
}
|
||||
|
||||
// Apply config to copied fields because many tests only set the old
|
||||
//values.
|
||||
config.ACLResolverSettings.ACLsEnabled = config.ACLsEnabled
|
||||
config.ACLResolverSettings.NodeName = config.NodeName
|
||||
config.ACLResolverSettings.Datacenter = config.Datacenter
|
||||
|
||||
var err error
|
||||
srv, err = newServer(t, config)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user