Skip to content

Race Condition During Unit Tests #192

@its-hammer-time

Description

@its-hammer-time

I just had a CI build fail due to a race condition with one of the unit tests. The unit tests expects a slice, but the ordering of the output was different than what was expected so it failed. Restarting CI passed so it's definitely not related to my changes.

https://github.com/pb33f/libopenapi-validator/actions/runs/18506092220/job/52735226063?pr=187

Run go test ./...
  
Circular references:  1
Successfully parsed OpenAPI spec
Circular references:  1
Successfully parsed OpenAPI spec
--- FAIL: ExampleNewValidator_validateHttpRequest (0.02s)
got:
Type: parameter, Failure: Path parameter 'petId' is not a valid integer
Type: security, Failure: API Key api_key not found in header
want:
Type: security, Failure: API Key api_key not found in header
Type: parameter, Failure: Path parameter 'petId' is not a valid integer
FAIL
FAIL	github.com/pb33f/libopenapi-validator	0.658s
ok  	github.com/pb33f/libopenapi-validator/cache	0.008s
?   	github.com/pb33f/libopenapi-validator/cmd/validate	[no test files]
ok  	github.com/pb33f/libopenapi-validator/config	0.008s
ok  	github.com/pb33f/libopenapi-validator/errors	0.013s
ok  	github.com/pb33f/libopenapi-validator/helpers	0.028s
ok  	github.com/pb33f/libopenapi-validator/openapi_vocabulary	0.015s
ok  	github.com/pb33f/libopenapi-validator/parameters	0.224s
ok  	github.com/pb33f/libopenapi-validator/paths	0.120s
ok  	github.com/pb33f/libopenapi-validator/requests	0.060s
ok  	github.com/pb33f/libopenapi-validator/responses	0.035s
ok  	github.com/pb33f/libopenapi-validator/schema_validation	0.075s
ok  	github.com/pb33f/libopenapi-validator/schema_validation/openapi_schemas	0.439s
FAIL
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions