mirror of
https://github.com/status-im/consul.git
synced 2025-02-02 08:56:43 +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.AutoConfigAuthzAllowReuse = true
|
||||||
|
|
||||||
|
c.ACLResolverSettings.ACLDisabledTTL = 12 * time.Second
|
||||||
|
|
||||||
cafile := path.Join(c.DataDir, "cacert.pem")
|
cafile := path.Join(c.DataDir, "cacert.pem")
|
||||||
err := ioutil.WriteFile(cafile, []byte(cacert), 0600)
|
err := ioutil.WriteFile(cafile, []byte(cacert), 0600)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -263,7 +265,7 @@ func TestAutoConfigInitialConfiguration(t *testing.T) {
|
|||||||
PolicyTTL: "30s",
|
PolicyTTL: "30s",
|
||||||
TokenTTL: "30s",
|
TokenTTL: "30s",
|
||||||
RoleTTL: "30s",
|
RoleTTL: "30s",
|
||||||
DisabledTTL: "0s",
|
DisabledTTL: "12s",
|
||||||
DownPolicy: "extend-cache",
|
DownPolicy: "extend-cache",
|
||||||
DefaultPolicy: "deny",
|
DefaultPolicy: "deny",
|
||||||
Tokens: &pbconfig.ACLTokens{
|
Tokens: &pbconfig.ACLTokens{
|
||||||
|
@ -245,6 +245,12 @@ func testServerWithConfig(t *testing.T, cb func(*Config)) (string, *Server) {
|
|||||||
cb(config)
|
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
|
var err error
|
||||||
srv, err = newServer(t, config)
|
srv, err = newServer(t, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user