-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Janos <[email protected]>
- Loading branch information
Janos
committed
Aug 12, 2024
1 parent
91fe31e
commit 98e173e
Showing
2 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Randomness sources | ||
|
||
This folder contains a number of randomness sources for testing purposes, some deterministic, some not. | ||
|
||
To obtain a deterministic randomness source *tied to a test name*, you can use the `DeterministicSource` (implementing an `io.Reader`) as follows: | ||
|
||
```go | ||
package your_test | ||
|
||
import ( | ||
"testing" | ||
"your" | ||
|
||
"github.com/opentofu/tofutestutils/testrandom" | ||
) | ||
|
||
func TestMyApp(t *testing.T) { | ||
randomness := testrandom.DeterministicSource(t) | ||
|
||
your.App(randomness) | ||
} | ||
``` | ||
|
||
For a full list of possible functions, please [check the Go docs](https://pkg.go.dev/github.com/opentofu/tofutestutils/testrandom). |