Skip to content

Commit

Permalink
Make all possible tests in config package to run in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandr Samylkin committed Mar 14, 2017
1 parent e8b782f commit 1b1b968
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func TestGlobalConfig(t *testing.T) {
}

func TestRootNodeConfig(t *testing.T) {
t.Parallel()
txt := []byte(`
one:
two: hello
Expand Down Expand Up @@ -177,7 +178,7 @@ func TestOverrideSimple(t *testing.T) {
}

func TestSimpleConfigValues(t *testing.T) {

t.Parallel()
provider := NewProviderGroup(
"test",
NewYAMLProviderFromBytes(yamlConfig3),
Expand All @@ -194,6 +195,7 @@ func TestSimpleConfigValues(t *testing.T) {
}

func TestGetAsIntegerValue(t *testing.T) {
t.Parallel()
testCases := []struct {
value interface{}
}{
Expand All @@ -210,6 +212,7 @@ func TestGetAsIntegerValue(t *testing.T) {
}

func TestGetAsFloatValue(t *testing.T) {
t.Parallel()
testCases := []struct {
value interface{}
}{
Expand Down Expand Up @@ -298,6 +301,7 @@ func TestDefaultValue(t *testing.T) {
}

func TestInvalidConfigFailures(t *testing.T) {
t.Parallel()
valueType := []byte(`
id: xyz
boolean:
Expand Down
7 changes: 7 additions & 0 deletions config/static_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@ import (
)

func TestStaticProvider_Name(t *testing.T) {
t.Parallel()
p := NewStaticProvider(nil)
assert.Equal(t, "static", p.Name())
}

func TestNewStaticProvider_NilData(t *testing.T) {
t.Parallel()
p := NewStaticProvider(nil)

val := p.Get("something")
assert.False(t, val.HasValue())
}

func TestStaticProvider_WithData(t *testing.T) {
t.Parallel()
data := map[string]interface{}{
"hello": "world",
}
Expand All @@ -53,6 +56,7 @@ func TestStaticProvider_WithData(t *testing.T) {
}

func TestStaticProvider_WithGet(t *testing.T) {
t.Parallel()
data := map[string]interface{}{
"hello": map[string]int{"world": 42},
}
Expand All @@ -68,12 +72,14 @@ func TestStaticProvider_WithGet(t *testing.T) {
}

func TestStaticProvider_Callbacks(t *testing.T) {
t.Parallel()
p := NewStaticProvider(nil)
assert.NoError(t, p.RegisterChangeCallback("test", nil))
assert.NoError(t, p.UnregisterChangeCallback("token"))
}

func TestStaticProviderFmtPrintOnValueNoPanic(t *testing.T) {
t.Parallel()
p := NewStaticProvider(nil)
val := p.Get("something")

Expand All @@ -84,6 +90,7 @@ func TestStaticProviderFmtPrintOnValueNoPanic(t *testing.T) {
}

func TestNilStaticProviderSetDefaultTagValue(t *testing.T) {
t.Parallel()
type Inner struct {
Set bool `yaml:"set" default:"true"`
}
Expand Down

0 comments on commit 1b1b968

Please sign in to comment.