swagger-api / swagger-api/swagger-codegen

[Go] Travis CI failure with Go API client's concurrency test

Open
#5,102 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Go Issue: Bug
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Sometimes, we may get the following test failure in 2.3.0 branch with the Go API client for Petstore:

=== RUN TestDeletePet
--- PASS: TestDeletePet (0.00s)
=== RUN TestConcurrency
--- FAIL: TestConcurrency (1.02s)
	Error Trace:	pet_api_test.go:193
			pet_api_test.go:165
	Error:      	Not equal: 
	            	expected: 0
	            	received: 12348
	Messages:   	Pet id should be equal
	Error Trace:	pet_api_test.go:194
			pet_api_test.go:165
	Error:      	Not equal: 
	            	expected: ""
	            	received: "gopherJohn"
	Messages:   	Pet name should be gopherJohn
	Error Trace:	pet_api_test.go:195
			pet_api_test.go:165
	Error:      	Not equal: 
	            	expected: ""
	            	received: "dead"
	Messages:   	Pet status should be dead
	pet_api_test.go:200: &{404 Not Found 404 HTTP/1.1 1 1 map[Content-Type:[application/json] Server:[Jetty(9.2.9.v20150224)] Date:[Fri, 17 Mar 2017 11:05:59 GMT] Access-Control-Allow-Origin:[*] Access-Control-Allow-Methods:[GET, POST, DELETE, PUT] Access-Control-Allow-Headers:[Content-Type, api_key, Authorization]] 0xc208120440 -1 [chunked] false map[] 0xc20801f790 <nil>}
	pet_api_test.go:182: &{404 Not Found 404 HTTP/1.1 1 1 map[Date:[Fri, 17 Mar 2017 11:05:59 GMT] Access-Control-Allow-Origin:[*] Access-Control-Allow-Methods:[GET, POST, DELETE, PUT] Access-Control-Allow-Headers:[Content-Type, api_key, Authorization] Content-Length:[0] Server:[Jetty(9.2.9.v20150224)]] 0xc208120a00 0 [] false map[] 0xc20801f110 <nil>}
=== RUN TestCreateUser
--- PASS: TestCreateUser (0.00s)
=== RUN TestCreateUsersWithArrayInput
--- PASS: TestCreateUsersWithArrayInput (0.00s)
=== RUN TestGetUserByName
--- PASS: TestGetUserByName (0.00s)
=== RUN TestGetUserByNameWithInvalidID
--- PASS: TestGetUserByNameWithInvalidID (0.00s)
	user_api_test.go:109: &{0       0}
	user_api_test.go:112: &{404 Not Found 404 HTTP/1.1 1 1 map[Access-Control-Allow-Methods:[GET, POST, DELETE, PUT] Access-Control-Allow-Headers:[Content-Type, api_key, Authorization] Content-Type:[application/json] Server:[Jetty(9.2.9.v20150224)] Date:[Fri, 17 Mar 2017 11:05:59 GMT] Access-Control-Allow-Origin:[*]] 0xc208121680 -1 [chunked] false map[] 0xc20801fba0 <nil>}
=== RUN TestUpdateUser
--- PASS: TestUpdateUser (0.01s)
=== RUN TestDeleteUser
--- PASS: TestDeleteUser (0.02s)`

Ref: https://api.travis-ci.org/jobs/212060955/log.txt?deansi=true

Seems like the Go API client has issues with concurrent requests.

Swagger-codegen version

2.3.0

Command line used for generation
Steps to reproduce

Submit a PR and the CI (travis) might failed

Related issues
Suggest a Fix

The issue might be addressed by https://github.com/swagger-api/swagger-codegen/pull/5037 but I'm not entirely sure.

cc @antihax

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pet_api_test.go around the reported lines 165, 182, 193-200 and review the Travis log linked in the issue. Compare the concurrency behavior with pull request #5037, which the issue identifies as a possible fix. Done means the Go API client's TestConcurrency passes reliably in CI without the reported mismatched pet data or 404 responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.