Commit b852413
authored
fix TestClientOnResponseError parallel tests (#710)
In case of using `t.Parallel()` inside a for loop, the loop variables must be copied, otherwise only the last test will be executed.
```go
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
```
changed to
```go
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
```
also the AuthServer must be created within the test, otherwise some tests fail.
`t.Log(test.Name)` can be used to verify the issue:
```go
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
t.Log("Test name:", test.name)
```1 parent 106e689 commit b852413
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
780 | 780 | | |
781 | 781 | | |
782 | 782 | | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | 783 | | |
787 | 784 | | |
788 | 785 | | |
| |||
862 | 859 | | |
863 | 860 | | |
864 | 861 | | |
| 862 | + | |
865 | 863 | | |
866 | 864 | | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
867 | 868 | | |
868 | 869 | | |
869 | 870 | | |
| |||
0 commit comments