go-openapi / spec

openapi specification object model
Apache License 2.0
394 stars 100 forks source link

Tests fail on Windows platform #62

Closed fredbi closed 6 years ago

fredbi commented 6 years ago

The package has introduced a regression on Windows platform.

Running go test -v on Windows 10 with go 1.9, I get:

C:\Users\root\go\src\github.com\go-openapi\spec>go test -v -timeout 20m === RUN TestSerialization_AuthSerialization --- PASS: TestSerialization_AuthSerialization (0.00s) === RUN TestSerialization_AuthDeserialization --- PASS: TestSerialization_AuthDeserialization (0.00s) === RUN TestIntegrationContactInfo --- PASS: TestIntegrationContactInfo (0.00s) === RUN TestNormalizePaths --- FAIL: TestNormalizePaths (0.00s) expander_test.go:73: Error Trace: expander_test.go:73 Error: Not equal: expected: "/another/base/path.json#/definitions/Pet" actual : "\another\base\path.json#\definitions\Pet" Test: TestNormalizePaths expander_test.go:73: Error Trace: expander_test.go:73 Error: Not equal: expected: "/base/another/base/path.json#/definitions/Pet" actual : "\base\another\base\path.json#/definitions/Pet" Test: TestNormalizePaths === RUN TestExpandsKnownRef --- PASS: TestExpandsKnownRef (0.01s) === RUN TestExpandResponseSchema --- PASS: TestExpandResponseSchema (0.02s) === RUN TestSpecExpansion --- PASS: TestSpecExpansion (0.02s) === RUN TestResolveRef --- PASS: TestResolveRef (0.00s) === RUN TestResponseExpansion 2018/02/22 16:13:17 {"description":"pet response","schema":{"required":["id","name"],"properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}} 2018/02/22 16:13:17 {"description":"pet response","schema":{"required":["id","name"],"properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}} --- PASS: TestResponseExpansion (0.14s) === RUN TestExportedResponseExpansion 2018/02/22 16:13:17 {"description":"pet response","schema":{"required":["id","name"],"properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}} 2018/02/22 16:13:17 {"description":"pet response","schema":{"required":["id","name"],"properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}} --- PASS: TestExportedResponseExpansion (0.01s) === RUN TestIssue3 --- PASS: TestIssue3 (0.02s) === RUN TestParameterExpansion --- PASS: TestParameterExpansion (0.01s) === RUN TestExportedParameterExpansion --- PASS: TestExportedParameterExpansion (0.00s) === RUN TestCircularRefsExpansion panic: test timed out after 20m0s goroutine 36 [running]: testing.startAlarm.func1() D:/Go/src/testing/testing.go:1145 +0x100 created by time.goFunc D:/Go/src/time/sleep.go:170 +0x4b

goroutine 1 [chan receive, 20 minutes]: testing.(T).Run(0xc0423de000, 0x7d94b6, 0x19, 0x7ee658, 0x482e01) D:/Go/src/testing/testing.go:790 +0x303 testing.runTests.func1(0xc0423de000) D:/Go/src/testing/testing.go:1004 +0x6b testing.tRunner(0xc0423de000, 0xc04205dde0) D:/Go/src/testing/testing.go:746 +0xd7 testing.runTests(0xc04215c7a0, 0x9c2380, 0x3b, 0x3b, 0x0) D:/Go/src/testing/testing.go:1002 +0x2df testing.(M).Run(0xc04212bf18, 0xc04205df70) D:/Go/src/testing/testing.go:921 +0x118 main.main() github.com/go-openapi/spec/_test/_testmain.go:160 +0xe2

goroutine 51 [runnable]: encoding/json.(decodeState).scanWhile(0xc16c7a65a0, 0x9, 0xc15ec7d54c) D:/Go/src/encoding/json/decode.go:346 +0xad encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1092 +0x1d3 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a17ddd) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xa, 0x7a17df8) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a17e06) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a17e1f) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xa, 0x7a17e3a) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a17e48) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xa, 0x7a17e64) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a17eb4) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a17ecd) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x9, 0x7a17ed8) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a18051) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x8, 0x7a1806b) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a18584) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a1859d) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x9, 0x7a185a8) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a18730) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x16, 0x7a18758) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a18766) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a188b8) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a188d1) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x9, 0x7a188dc) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a18a76) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x16, 0x7a18a9e) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a18aac) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a18c04) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a18c1d) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x9, 0x7a18c28) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a18dce) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a18de7) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x9, 0x7a18df2) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a2abb1) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a2abca) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x9, 0x7a2abd5) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a2ad8a) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a2ada3) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x9, 0x7a2adae) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a60af6) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a60b0f) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x9, 0x7a60b1a) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a60cf3) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x16, 0x7a60d1b) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a60d29) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a60e96) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x7, 0x7a60eaf) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x9, 0x7a60eba) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a610b7) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0x16, 0x7a610df) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a610ed) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 encoding/json.(decodeState).valueInterface(0xc16c7a65a0, 0xc, 0x7a61266) D:/Go/src/encoding/json/decode.go:1023 +0xd0 encoding/json.(decodeState).objectInterface(0xc16c7a65a0, 0x9) D:/Go/src/encoding/json/decode.go:1089 +0x156 ...additional frames elided... created by testing.(*T).Run D:/Go/src/testing/testing.go:789 +0x2e5 exit status 2 FAIL github.com/go-openapi/spec 1201.971s

C:\Users\root\go\src\github.com\go-openapi\spec>

fredbi commented 6 years ago

Failure #1 C:\Users\root\go\src\github.com\go-openapi\spec>go test -v -run Normalize === RUN TestNormalizePaths --- FAIL: TestNormalizePaths (0.00s) expander_test.go:73: Error Trace: expander_test.go:73 Error: Not equal: expected: "/another/base/path.json#/definitions/Pet" actual : "\another\base\path.json#\definitions\Pet" Test: TestNormalizePaths expander_test.go:73: Error Trace: expander_test.go:73 Error: Not equal: expected: "/base/another/base/path.json#/definitions/Pet" actual : "\base\another\base\path.json#/definitions/Pet" Test: TestNormalizePaths FAIL exit status 1 FAIL github.com/go-openapi/spec 0.593s

fredbi commented 6 years ago

Failure #2: hang on this C:\Users\root\go\src\github.com\go-openapi\spec>go test -v -run CircularRefsExpansion === RUN TestCircularRefsExpansion ....

Because of non-normalized Ref at https://github.com/go-openapi/spec/blob/1de3e0542de65ad8d75452a595886fdd0befb363/expander.go#L621

fredbi commented 6 years ago

Failure #3: when running go-swagger test suite on Windows, this fails - the validation test tries to expand a ref and fails (works fine on unix).

=== RUN TestCmd_Validate_Issue342_Correct --- FAIL: TestCmd_Validate_Issue342_Correct (4.49s) Error Trace: validate_test.go:91 Error: Received unexpected error: The swagger spec at "..\..\..\fixtures\bugs\342\fixture-342-3.yaml" is invalid against swagger specification 2.0. See errors below:

fredbi commented 6 years ago

Provided details of each separate failure on windows on dedicated issues.