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