Skip to content

Commit 9d990b9

Browse files
mx-psicodeboten
andauthored
[chore][confmap] Add string representation to mocked env provider (#10559)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description <!-- Issue number if applicable --> Adds string representation to all inputs returned by mock env provider used in tests. The real `env` provider (and all other providers on this repository) do this by default since they use `NewRetrievedFromYAML`. Note that certain types are not really obtainable with the real `env` provider (e.g. `int32` or `float64`). I have kept them and added the string representation manually. #### Link to tracking issue Needed for #10554 Co-authored-by: Alex Boten <[email protected]>
1 parent c0b6063 commit 9d990b9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

confmap/expand_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -414,27 +414,27 @@ func newEnvProvider() ProviderFactory {
414414
}
415415
switch uri {
416416
case "env:COMPLEX_VALUE":
417-
return NewRetrieved([]any{"localhost:3042"})
417+
return NewRetrievedFromYAML([]byte("[localhost:3042]"))
418418
case "env:HOST":
419-
return NewRetrieved("localhost")
419+
return NewRetrievedFromYAML([]byte("localhost"))
420420
case "env:OS":
421-
return NewRetrieved("ubuntu")
421+
return NewRetrievedFromYAML([]byte("ubuntu"))
422422
case "env:PR":
423-
return NewRetrieved("amd")
423+
return NewRetrievedFromYAML([]byte("amd"))
424424
case "env:PORT":
425-
return NewRetrieved(3044)
425+
return NewRetrievedFromYAML([]byte("3044"))
426426
case "env:INT":
427-
return NewRetrieved(1)
427+
return NewRetrievedFromYAML([]byte("1"))
428428
case "env:INT32":
429-
return NewRetrieved(32)
429+
return NewRetrieved(int32(32), withStringRepresentation("32"))
430430
case "env:INT64":
431-
return NewRetrieved(64)
431+
return NewRetrieved(int64(64), withStringRepresentation("64"))
432432
case "env:FLOAT32":
433-
return NewRetrieved(float32(3.25))
433+
return NewRetrieved(float32(3.25), withStringRepresentation("3.25"))
434434
case "env:FLOAT64":
435-
return NewRetrieved(float64(6.4))
435+
return NewRetrieved(float64(6.4), withStringRepresentation("6.4"))
436436
case "env:BOOL":
437-
return NewRetrieved(true)
437+
return NewRetrievedFromYAML([]byte("true"))
438438
}
439439
return nil, errors.New("impossible")
440440
})

0 commit comments

Comments
 (0)