Skip to content

Commit 3a23b80

Browse files
alexandearsagikazarmark
authored andcommitted
ci: enable test shuffle; fix tests
1 parent 73dfb94 commit 3a23b80

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.github/workflows/ci.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ jobs:
5757
go-version: ${{ matrix.go }}
5858

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

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

6767
lint:

flags_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
)
1010

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

1415
testValues := map[string]*string{

viper_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ func TestReadInConfig(t *testing.T) {
471471
}
472472

473473
func TestDefault(t *testing.T) {
474+
Reset()
474475
SetDefault("age", 45)
475476
assert.Equal(t, 45, Get("age"))
476477

@@ -485,6 +486,7 @@ func TestDefault(t *testing.T) {
485486
}
486487

487488
func TestUnmarshaling(t *testing.T) {
489+
Reset()
488490
SetConfigType("yaml")
489491
r := bytes.NewReader(yamlExample)
490492

@@ -521,13 +523,16 @@ func TestDefaultPost(t *testing.T) {
521523
}
522524

523525
func TestAliases(t *testing.T) {
526+
initConfigs()
527+
Set("age", 40)
524528
RegisterAlias("years", "age")
525529
assert.Equal(t, 40, Get("years"))
526530
Set("years", 45)
527531
assert.Equal(t, 45, Get("age"))
528532
}
529533

530534
func TestAliasInConfigFile(t *testing.T) {
535+
initConfigs()
531536
// the config file specifies "beard". If we make this an alias for
532537
// "hasbeard", we still want the old config file to work with beard.
533538
RegisterAlias("beard", "hasbeard")
@@ -870,6 +875,7 @@ func TestRecursiveAliases(t *testing.T) {
870875
}
871876

872877
func TestUnmarshal(t *testing.T) {
878+
Reset()
873879
SetDefault("port", 1313)
874880
Set("name", "Steve")
875881
Set("duration", "1s1ms")
@@ -1341,6 +1347,7 @@ func TestBindPFlagStringToInt(t *testing.T) {
13411347
}
13421348

13431349
func TestBoundCaseSensitivity(t *testing.T) {
1350+
initConfigs()
13441351
assert.Equal(t, "brown", Get("eyes"))
13451352

13461353
BindEnv("eYEs", "TURTLE_EYES")

0 commit comments

Comments
 (0)