Skip to content

Commit

Permalink
Add test for new env variable
Browse files Browse the repository at this point in the history
Signed-off-by: Masroor Hasan <masroor.hasan.n@gmail.com>
  • Loading branch information
masroorhasan committed Aug 21, 2018
1 parent 550b381 commit f5f36b7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions config/config_test.go
Expand Up @@ -116,9 +116,11 @@ func TestNoServiceNameFromEnv(t *testing.T) {

func TestSamplerConfigFromEnv(t *testing.T) {
// prepare
testMgrHostPort := "http://themaster:80"
os.Setenv(envSamplerType, "const")
os.Setenv(envSamplerParam, "1")
os.Setenv(envSamplerManagerHostPort, "http://themaster")
os.Setenv(envConfigManagerHostPort, testMgrHostPort)
os.Setenv(envSamplerManagerHostPort, testMgrHostPort) // deprecated
os.Setenv(envSamplerMaxOperations, "10")
os.Setenv(envSamplerRefreshInterval, "1m1s") // 61 seconds

Expand All @@ -129,7 +131,8 @@ func TestSamplerConfigFromEnv(t *testing.T) {
// verify
assert.Equal(t, "const", cfg.Sampler.Type)
assert.Equal(t, float64(1), cfg.Sampler.Param)
assert.Equal(t, "http://themaster", cfg.Sampler.SamplingServerURL)
assert.Equal(t, testMgrHostPort, cfg.Sampler.SamplingServerURL)
assert.Equal(t, testMgrHostPort, cfg.Sampler.SamplingServerURL)
assert.Equal(t, int(10), cfg.Sampler.MaxOperations)
assert.Equal(t, 61000000000, int(cfg.Sampler.SamplingRefreshInterval))

Expand Down

0 comments on commit f5f36b7

Please sign in to comment.