mirror of https://github.com/status-im/consul.git
test: Use Bool() instead of &BoolTrue/False since
This commit is contained in:
parent
1b0d58bb22
commit
ceda18366f
|
@ -40,7 +40,7 @@ func (m *MockServer) GetPolicy(args *structs.ACLPolicyRequest, reply *structs.AC
|
|||
func TestACL_Version8(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestConfig()
|
||||
cfg.ACLEnforceVersion8 = &BoolFalse
|
||||
cfg.ACLEnforceVersion8 = Bool(false)
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
||||
|
@ -63,7 +63,7 @@ func TestACL_Disabled(t *testing.T) {
|
|||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLDisabledTTL = 10 * time.Millisecond
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
||||
|
@ -115,7 +115,7 @@ func TestACL_Disabled(t *testing.T) {
|
|||
func TestACL_Special_IDs(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
cfg.ACLAgentMasterToken = "towel"
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -168,7 +168,7 @@ func TestACL_Down_Deny(t *testing.T) {
|
|||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLDownPolicy = "deny"
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -198,7 +198,7 @@ func TestACL_Down_Allow(t *testing.T) {
|
|||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLDownPolicy = "allow"
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -228,7 +228,7 @@ func TestACL_Down_Extend(t *testing.T) {
|
|||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLDownPolicy = "extend-cache"
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -305,7 +305,7 @@ func TestACL_Down_Extend(t *testing.T) {
|
|||
func TestACL_Cache(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -487,7 +487,7 @@ func catalogPolicy(req *structs.ACLPolicyRequest, reply *structs.ACLPolicy) erro
|
|||
func TestACL_vetServiceRegister(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -533,7 +533,7 @@ func TestACL_vetServiceRegister(t *testing.T) {
|
|||
func TestACL_vetServiceUpdate(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -569,7 +569,7 @@ func TestACL_vetServiceUpdate(t *testing.T) {
|
|||
func TestACL_vetCheckRegister(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -652,7 +652,7 @@ func TestACL_vetCheckRegister(t *testing.T) {
|
|||
func TestACL_vetCheckUpdate(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -708,7 +708,7 @@ func TestACL_vetCheckUpdate(t *testing.T) {
|
|||
func TestACL_filterMembers(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -744,7 +744,7 @@ func TestACL_filterMembers(t *testing.T) {
|
|||
func TestACL_filterServices(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -775,7 +775,7 @@ func TestACL_filterServices(t *testing.T) {
|
|||
func TestACL_filterChecks(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestACLConfig()
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
|
|
@ -2863,7 +2863,7 @@ func TestDNS_NodeLookup_TTL(t *testing.T) {
|
|||
cfg := TestConfig()
|
||||
cfg.DNSRecursor = recursor.Addr
|
||||
cfg.DNSConfig.NodeTTL = 10 * time.Second
|
||||
cfg.DNSConfig.AllowStale = &BoolTrue
|
||||
cfg.DNSConfig.AllowStale = Bool(true)
|
||||
cfg.DNSConfig.MaxStale = time.Second
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -2981,7 +2981,7 @@ func TestDNS_ServiceLookup_TTL(t *testing.T) {
|
|||
"db": 10 * time.Second,
|
||||
"*": 5 * time.Second,
|
||||
}
|
||||
cfg.DNSConfig.AllowStale = &BoolTrue
|
||||
cfg.DNSConfig.AllowStale = Bool(true)
|
||||
cfg.DNSConfig.MaxStale = time.Second
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -3081,7 +3081,7 @@ func TestDNS_PreparedQuery_TTL(t *testing.T) {
|
|||
"db": 10 * time.Second,
|
||||
"*": 5 * time.Second,
|
||||
}
|
||||
cfg.DNSConfig.AllowStale = &BoolTrue
|
||||
cfg.DNSConfig.AllowStale = Bool(true)
|
||||
cfg.DNSConfig.MaxStale = time.Second
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
@ -3825,7 +3825,7 @@ func TestDNS_NonExistingLookupEmptyAorAAAA(t *testing.T) {
|
|||
func TestDNS_PreparedQuery_AllowStale(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := TestConfig()
|
||||
cfg.DNSConfig.AllowStale = &BoolTrue
|
||||
cfg.DNSConfig.AllowStale = Bool(true)
|
||||
cfg.DNSConfig.MaxStale = time.Second
|
||||
a := NewTestAgent(t.Name(), cfg)
|
||||
defer a.Shutdown()
|
||||
|
|
|
@ -470,7 +470,7 @@ func TestAgentAntiEntropy_Services_ACLDeny(t *testing.T) {
|
|||
cfg.ACLDatacenter = "dc1"
|
||||
cfg.ACLMasterToken = "root"
|
||||
cfg.ACLDefaultPolicy = "deny"
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
a := &TestAgent{Name: t.Name(), Config: cfg, NoInitialSync: true}
|
||||
a.Start()
|
||||
defer a.Shutdown()
|
||||
|
@ -842,7 +842,7 @@ func TestAgentAntiEntropy_Checks_ACLDeny(t *testing.T) {
|
|||
cfg.ACLDatacenter = "dc1"
|
||||
cfg.ACLMasterToken = "root"
|
||||
cfg.ACLDefaultPolicy = "deny"
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
a := &TestAgent{Name: t.Name(), Config: cfg, NoInitialSync: true}
|
||||
a.Start()
|
||||
defer a.Shutdown()
|
||||
|
|
|
@ -279,10 +279,6 @@ func pickRandomPorts(c *Config) {
|
|||
c.Ports.Server = port + 6
|
||||
}
|
||||
|
||||
// BoolTrue and BoolFalse exist to create a *bool value.
|
||||
var BoolTrue = true
|
||||
var BoolFalse = false
|
||||
|
||||
// TestConfig returns a unique default configuration for testing an
|
||||
// agent.
|
||||
func TestConfig() *Config {
|
||||
|
@ -335,6 +331,6 @@ func TestACLConfig() *Config {
|
|||
cfg.ACLMasterToken = "root"
|
||||
cfg.ACLAgentToken = "root"
|
||||
cfg.ACLAgentMasterToken = "towel"
|
||||
cfg.ACLEnforceVersion8 = &BoolTrue
|
||||
cfg.ACLEnforceVersion8 = Bool(true)
|
||||
return cfg
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue