-
Notifications
You must be signed in to change notification settings - Fork 53
/
pools_test.go
48 lines (39 loc) · 1.22 KB
/
pools_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package validate_test
import (
"path/filepath"
"testing"
"github.com/go-openapi/loads"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/validate"
"github.com/stretchr/testify/require"
)
func Test_ParallelPool(t *testing.T) {
fixture1 := filepath.Join("fixtures", "bugs", "1429", "swagger.yaml")
fixture2 := filepath.Join("fixtures", "bugs", "2866", "2866.yaml")
fixture3 := filepath.Join("fixtures", "bugs", "43", "fixture-43.yaml")
t.Run("should validate in parallel", func(t *testing.T) {
for i := 0; i < 20; i++ {
t.Run("validating fixture 1", func(t *testing.T) {
t.Parallel()
doc1, err := loads.Spec(fixture1)
require.NoError(t, err)
require.NotNil(t, doc1)
require.NoError(t, validate.Spec(doc1, strfmt.Default))
})
t.Run("validating fixture 2", func(t *testing.T) {
t.Parallel()
doc2, err := loads.Spec(fixture2)
require.NoError(t, err)
require.NotNil(t, doc2)
require.NoError(t, validate.Spec(doc2, strfmt.Default))
})
t.Run("validating fixture 2", func(t *testing.T) {
t.Parallel()
doc3, err := loads.Spec(fixture3)
require.NoError(t, err)
require.NotNil(t, doc3)
require.NoError(t, validate.Spec(doc3, strfmt.Default))
})
}
})
}