Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: enable test shuffle and fix tests #1643

Merged
merged 1 commit into from Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Expand Up @@ -57,11 +57,11 @@ jobs:
go-version: ${{ matrix.go }}

- name: Test
run: go test -race -v -tags '${{ matrix.tags }}' ./...
run: go test -race -v -tags '${{ matrix.tags }}' -shuffle=on ./...
if: runner.os != 'Windows'

- name: Test (without race detector)
run: go test -v -tags '${{ matrix.tags }}' ./...
run: go test -v -tags '${{ matrix.tags }}' -shuffle=on ./...
if: runner.os == 'Windows'

lint:
Expand Down
1 change: 1 addition & 0 deletions flags_test.go
Expand Up @@ -8,6 +8,7 @@ import (
)

func TestBindFlagValueSet(t *testing.T) {
Reset()
flagSet := pflag.NewFlagSet("test", pflag.ContinueOnError)

testValues := map[string]*string{
Expand Down
7 changes: 7 additions & 0 deletions viper_test.go
Expand Up @@ -472,6 +472,7 @@ func TestReadInConfig(t *testing.T) {
}

func TestDefault(t *testing.T) {
Reset()
SetDefault("age", 45)
assert.Equal(t, 45, Get("age"))

Expand All @@ -486,6 +487,7 @@ func TestDefault(t *testing.T) {
}

func TestUnmarshaling(t *testing.T) {
Reset()
SetConfigType("yaml")
r := bytes.NewReader(yamlExample)

Expand Down Expand Up @@ -524,13 +526,16 @@ func TestDefaultPost(t *testing.T) {
}

func TestAliases(t *testing.T) {
initConfigs()
Set("age", 40)
RegisterAlias("years", "age")
assert.Equal(t, 40, Get("years"))
Set("years", 45)
assert.Equal(t, 45, Get("age"))
}

func TestAliasInConfigFile(t *testing.T) {
initConfigs()
// the config file specifies "beard". If we make this an alias for
// "hasbeard", we still want the old config file to work with beard.
RegisterAlias("beard", "hasbeard")
Expand Down Expand Up @@ -873,6 +878,7 @@ func TestRecursiveAliases(t *testing.T) {
}

func TestUnmarshal(t *testing.T) {
Reset()
SetDefault("port", 1313)
Set("name", "Steve")
Set("duration", "1s1ms")
Expand Down Expand Up @@ -1277,6 +1283,7 @@ func TestBindPFlagStringToInt(t *testing.T) {
}

func TestBoundCaseSensitivity(t *testing.T) {
initConfigs()
assert.Equal(t, "brown", Get("eyes"))

BindEnv("eYEs", "TURTLE_EYES")
Expand Down