77 "time"
88)
99
10+ // nolint:paralleltest
11+ // t.Setenv doesn't work with t.Parallel()
1012func TestConfigurator (t * testing.T ) {
1113 // setting command line flag
1214 os .Args = []string {"smth" , "-name=flag_value" }
@@ -83,6 +85,8 @@ func TestConfigurator(t *testing.T) {
8385}
8486
8587func TestConfigurator_Errors (t * testing.T ) {
88+ t .Parallel ()
89+
8690 tests := map [string ]struct {
8791 input any
8892 providers []Provider
@@ -102,6 +106,8 @@ func TestConfigurator_Errors(t *testing.T) {
102106 for name , test := range tests {
103107 test := test
104108 t .Run (name , func (t * testing.T ) {
109+ t .Parallel ()
110+
105111 err := New (test .input , test .providers ... ).InitValues ()
106112 if err == nil {
107113 t .Fatal ("expected error but got nil" )
@@ -111,6 +117,8 @@ func TestConfigurator_Errors(t *testing.T) {
111117}
112118
113119func TestEmbeddedFlags (t * testing.T ) {
120+ t .Parallel ()
121+
114122 type (
115123 Client struct {
116124 ServerAddress string `flag:"addr|127.0.0.1:443|server address"`
@@ -130,6 +138,7 @@ func TestEmbeddedFlags(t *testing.T) {
130138 assert (t , cfg .Client .ServerAddress , "addr_value" )
131139}
132140
141+ // nolint:paralleltest
133142func TestFallBackToDefault (t * testing.T ) {
134143 // defining a struct
135144 cfg := struct {
@@ -149,6 +158,8 @@ func TestFallBackToDefault(t *testing.T) {
149158}
150159
151160func TestSetOnFailFn (t * testing.T ) {
161+ t .Parallel ()
162+
152163 cfg := struct {
153164 Name string `default:"test_name"`
154165 }{}
@@ -172,6 +183,8 @@ func TestSetOnFailFn(t *testing.T) {
172183}
173184
174185func TestProviderName (t * testing.T ) {
186+ t .Parallel ()
187+
175188 testCases := map [string ]struct {
176189 provider Provider
177190 expectedName string
@@ -198,21 +211,29 @@ func TestProviderName(t *testing.T) {
198211 test := test
199212
200213 t .Run (name , func (t * testing.T ) {
214+ t .Parallel ()
215+
201216 assert (t , test .expectedName , test .provider .Name ())
202217 })
203218 }
204219}
205220
206221func TestConfigurator_NameCollision (t * testing.T ) {
222+ t .Parallel ()
223+
207224 err := New (& struct {}{}, NewDefaultProvider (), NewDefaultProvider ()).InitValues ()
208225 assert (t , ErrProviderNameCollision , err )
209226}
210227
211228func TestConfigurator_FailedProvider (t * testing.T ) {
229+ t .Parallel ()
230+
212231 err := New (& struct {}{}, NewJSONFileProvider ("doesn't exist" )).InitValues ()
213232 assert (t , "cannot init [JSONFileProvider] provider: JSONFileProvider.Init: open doesn't exist: no such file or directory" , err .Error ())
214233}
215234
235+ // nolint:paralleltest
236+ // t.Setenv doesn't work with t.Parallel()
216237func Test_FromEnvAndDefault (t * testing.T ) {
217238 t .Setenv ("AGE" , "24" )
218239
0 commit comments