open-consul/agent/consul/server_oss_test.go
hashicorp-copywrite[bot] 87aee8308b
[COMPLIANCE] Add Copyright and License Headers (#16854)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Ronald <roncodingenthusiast@users.noreply.github.com>
2023-04-20 12:40:22 +00:00

47 lines
862 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
//go:build !consulent
// +build !consulent
package consul
import (
"os"
"testing"
"github.com/stretchr/testify/require"
"github.com/hashicorp/consul/testrpc"
)
func TestAgent_ReloadConfig_Reporting(t *testing.T) {
if testing.Short() {
t.Skip("too slow for testing.Short")
}
t.Parallel()
dir1, s := testServerWithConfig(t, func(c *Config) {
c.Reporting.License.Enabled = false
})
defer os.RemoveAll(dir1)
defer s.Shutdown()
testrpc.WaitForTestAgent(t, s.RPC, "dc1")
require.Equal(t, false, s.config.Reporting.License.Enabled)
rc := ReloadableConfig{
Reporting: Reporting{
License: License{
Enabled: true,
},
},
}
require.NoError(t, s.ReloadConfig(rc))
// Check config reload is no-op
require.Equal(t, false, s.config.Reporting.License.Enabled)
}