mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 04:20:14 +00:00
fix: data race
This commit is contained in:
@@ -1191,3 +1191,61 @@ func TestDocument_AdvanceCallbackReferences(t *testing.T) {
|
||||
|
||||
assert.Empty(t, buf.String())
|
||||
}
|
||||
|
||||
func BenchmarkLoadDocTwice(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
||||
spec, err := os.ReadFile("test_specs/speakeasy-test.yaml")
|
||||
require.NoError(b, err)
|
||||
|
||||
doc, err := NewDocumentWithConfiguration(spec, &datamodel.DocumentConfiguration{
|
||||
BasePath: "./test_specs",
|
||||
IgnorePolymorphicCircularReferences: true,
|
||||
IgnoreArrayCircularReferences: true,
|
||||
AllowFileReferences: true,
|
||||
})
|
||||
require.NoError(b, err)
|
||||
|
||||
_, errs := doc.BuildV3Model()
|
||||
require.Empty(b, errs)
|
||||
|
||||
doc, err = NewDocumentWithConfiguration(spec, &datamodel.DocumentConfiguration{
|
||||
BasePath: "./test_specs",
|
||||
IgnorePolymorphicCircularReferences: true,
|
||||
IgnoreArrayCircularReferences: true,
|
||||
AllowFileReferences: true,
|
||||
})
|
||||
require.NoError(b, err)
|
||||
|
||||
_, errs = doc.BuildV3Model()
|
||||
require.Empty(b, errs)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TestDocument_LoadDocTwice(t *testing.T) {
|
||||
spec, err := os.ReadFile("test_specs/speakeasy-test.yaml")
|
||||
require.NoError(t, err)
|
||||
|
||||
doc, err := NewDocumentWithConfiguration(spec, &datamodel.DocumentConfiguration{
|
||||
BasePath: "./test_specs",
|
||||
IgnorePolymorphicCircularReferences: true,
|
||||
IgnoreArrayCircularReferences: true,
|
||||
AllowFileReferences: true,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
_, errs := doc.BuildV3Model()
|
||||
require.Empty(t, errs)
|
||||
|
||||
doc, err = NewDocumentWithConfiguration(spec, &datamodel.DocumentConfiguration{
|
||||
BasePath: "./test_specs",
|
||||
IgnorePolymorphicCircularReferences: true,
|
||||
IgnoreArrayCircularReferences: true,
|
||||
AllowFileReferences: true,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
_, errs = doc.BuildV3Model()
|
||||
require.Empty(t, errs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user