Skip to content

Commit

Permalink
reproduce #371
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Fenoll <[email protected]>
  • Loading branch information
fenollp committed Jun 21, 2021
1 parent 707e4ba commit 8e32b68
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
run: git --no-pager diff && [[ $(git --no-pager diff --name-only | wc -l) = 0 ]]

- run: go test ./...
- run: go test -v -run TestRaceyPatternSchema -race ./...
- run: |
cd openapi3/testdata
go get -u -v github.com/getkin/kin-openapi
Expand Down
26 changes: 26 additions & 0 deletions openapi3/race_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package openapi3_test

import (
"context"
"testing"

"github.com/getkin/kin-openapi/openapi3"
"github.com/stretchr/testify/require"
)

func TestRaceyPatternSchema(t *testing.T) {
schema := openapi3.Schema{
Pattern: "^test|for|race|condition$",
}

err := schema.Validate(context.Background())
require.NoError(t, err)

visit := func() {
err := schema.VisitJSONString("test")
require.NoError(t, err)
}

go visit()
visit()
}

0 comments on commit 8e32b68

Please sign in to comment.