Repository navigation
Expand file tree
/
Copy pathpools_test.go
More file actions
57 lines (45 loc) · 1.65 KB
/
Copy pathpools_test.go
File metadata and controls
57 lines (45 loc) · 1.65 KB
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
49
50
51
52
53
54
55
56
57
//go:build !windows && !darwin
// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
// SPDX-License-Identifier: Apache-2.0
package validate_test
import (
"path/filepath"
"testing"
"github.com/go-openapi/loads"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/testify/v2/require"
"github.com/go-openapi/validate"
)
func Test_ParallelPool(t *testing.T) {
// Hitting more stringent memory & threads constraints on windows, when running -race, so we disable this on
// that target OS. Typically, a CI runner breaks with "ThreadSanitizer failed to allocate ..."
// Also -race in this context times out on macos. We need our validation on our platform only.
fixture1 := filepath.Join("testdata", "bugs", "1429", "swagger.yaml")
fixture2 := filepath.Join("testdata", "bugs", "2866", "2866.yaml")
fixture3 := filepath.Join("testdata", "bugs", "43", "fixture-43.yaml")
t.Run("should validate in parallel", func(t *testing.T) {
for range 20 {
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))
})
}
})
}