Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capturing 3 or more sequences leads to simulation problems #764

Closed
john4744 opened this issue Aug 21, 2018 · 1 comment
Closed

Capturing 3 or more sequences leads to simulation problems #764

john4744 opened this issue Aug 21, 2018 · 1 comment

Comments

@john4744
Copy link
Contributor

I start hoverfly, put it in capture mode with the --stateful option. Then issue the following requests:

#These requests capture with sequence state = sequence:1
curl -k -x http://localhost:8500 http://worldclockapi.com/api/json/utc/now
curl -k -x http://localhost:8500 http://worldclockapi.com/api/json/utc/now

#These requests capture with sequence state = sequence:2
curl -k -x http://localhost:8500 http://worldclockapi.com/api/json/est/now
curl -k -x http://localhost:8500 http://worldclockapi.com/api/json/est/now

#These requests capture with sequence state = sequence:1
curl -k -x http://localhost:8500 http://worldclockapi.com/api/json/pst/now
curl -k -x http://localhost:8500 http://worldclockapi.com/api/json/pst/now

I save this simulation to disk, then put hoverfly in simulate mode and import my simulation. When I issue the same set of requests again, I notice that my first request to http://worldclockapi.com/api/json/pst/now returns the second response instead of the first response.

I believe this is happening because it shares the same sequence state key as the first sequence that was captured.

Exported simulation json

{
	"data": {
		"pairs": [
			{
				"request": {
					"path": [
						{
							"matcher": "exact",
							"value": "/api/json/utc/now"
						}
					],
					"method": [
						{
							"matcher": "exact",
							"value": "GET"
						}
					],
					"destination": [
						{
							"matcher": "exact",
							"value": "worldclockapi.com"
						}
					],
					"scheme": [
						{
							"matcher": "exact",
							"value": "http"
						}
					],
					"body": [
						{
							"matcher": "exact",
							"value": ""
						}
					],
					"query": {},
					"requiresState": {
						"sequence:1": "1"
					}
				},
				"response": {
					"status": 200,
					"body": "{\"$id\":\"1\",\"currentDateTime\":\"2018-08-21T22:35Z\",\"utcOffset\":\"00:00:00\",\"isDayLightSavingsTime\":false,\"dayOfTheWeek\":\"Tuesday\",\"timeZoneName\":\"UTC\",\"currentFileTime\":131793645274283656,\"ordinalDate\":\"2018-233\",\"serviceResponse\":null}",
					"encodedBody": false,
					"headers": {
						"Cache-Control": [
							"no-cache"
						],
						"Content-Length": [
							"233"
						],
						"Content-Type": [
							"application/json; charset=utf-8"
						],
						"Date": [
							"Tue, 21 Aug 2018 22:35:27 GMT"
						],
						"Expires": [
							"-1"
						],
						"Hoverfly": [
							"Was-Here"
						],
						"Pragma": [
							"no-cache"
						],
						"Server": [
							"Microsoft-IIS/10.0"
						],
						"Set-Cookie": [
							"ARRAffinity=1d862f171f4d2e99f1ec9f1b7b37938eb01768c6c51f862fe110262dd6eae2f4;Path=/;HttpOnly;Domain=worldclockapi.com"
						],
						"Vary": [
							"Accept-Encoding"
						],
						"X-Aspnet-Version": [
							"4.0.30319"
						],
						"X-Powered-By": [
							"ASP.NET"
						]
					},
					"templated": false,
					"transitionsState": {
						"sequence:1": "2"
					}
				}
			},
			{
				"request": {
					"path": [
						{
							"matcher": "exact",
							"value": "/api/json/utc/now"
						}
					],
					"method": [
						{
							"matcher": "exact",
							"value": "GET"
						}
					],
					"destination": [
						{
							"matcher": "exact",
							"value": "worldclockapi.com"
						}
					],
					"scheme": [
						{
							"matcher": "exact",
							"value": "http"
						}
					],
					"body": [
						{
							"matcher": "exact",
							"value": ""
						}
					],
					"query": {},
					"requiresState": {
						"sequence:1": "2"
					}
				},
				"response": {
					"status": 200,
					"body": "{\"$id\":\"1\",\"currentDateTime\":\"2018-08-21T22:35Z\",\"utcOffset\":\"00:00:00\",\"isDayLightSavingsTime\":false,\"dayOfTheWeek\":\"Tuesday\",\"timeZoneName\":\"UTC\",\"currentFileTime\":131793645296970980,\"ordinalDate\":\"2018-233\",\"serviceResponse\":null}",
					"encodedBody": false,
					"headers": {
						"Cache-Control": [
							"no-cache"
						],
						"Content-Length": [
							"233"
						],
						"Content-Type": [
							"application/json; charset=utf-8"
						],
						"Date": [
							"Tue, 21 Aug 2018 22:35:29 GMT"
						],
						"Expires": [
							"-1"
						],
						"Hoverfly": [
							"Was-Here"
						],
						"Pragma": [
							"no-cache"
						],
						"Server": [
							"Microsoft-IIS/10.0"
						],
						"Set-Cookie": [
							"ARRAffinity=1d862f171f4d2e99f1ec9f1b7b37938eb01768c6c51f862fe110262dd6eae2f4;Path=/;HttpOnly;Domain=worldclockapi.com"
						],
						"Vary": [
							"Accept-Encoding"
						],
						"X-Aspnet-Version": [
							"4.0.30319"
						],
						"X-Powered-By": [
							"ASP.NET"
						]
					},
					"templated": false
				}
			},
			{
				"request": {
					"path": [
						{
							"matcher": "exact",
							"value": "/api/json/est/now"
						}
					],
					"method": [
						{
							"matcher": "exact",
							"value": "GET"
						}
					],
					"destination": [
						{
							"matcher": "exact",
							"value": "worldclockapi.com"
						}
					],
					"scheme": [
						{
							"matcher": "exact",
							"value": "http"
						}
					],
					"body": [
						{
							"matcher": "exact",
							"value": ""
						}
					],
					"query": {},
					"requiresState": {
						"sequence:2": "1"
					}
				},
				"response": {
					"status": 200,
					"body": "{\"$id\":\"1\",\"currentDateTime\":\"2018-08-21T18:35-04:00\",\"utcOffset\":\"-04:00:00\",\"isDayLightSavingsTime\":true,\"dayOfTheWeek\":\"Tuesday\",\"timeZoneName\":\"Eastern Standard Time\",\"currentFileTime\":131793501355992703,\"ordinalDate\":\"2018-233\",\"serviceResponse\":null}",
					"encodedBody": false,
					"headers": {
						"Cache-Control": [
							"no-cache"
						],
						"Content-Length": [
							"256"
						],
						"Content-Type": [
							"application/json; charset=utf-8"
						],
						"Date": [
							"Tue, 21 Aug 2018 22:35:35 GMT"
						],
						"Expires": [
							"-1"
						],
						"Hoverfly": [
							"Was-Here"
						],
						"Pragma": [
							"no-cache"
						],
						"Server": [
							"Microsoft-IIS/10.0"
						],
						"Set-Cookie": [
							"ARRAffinity=1d862f171f4d2e99f1ec9f1b7b37938eb01768c6c51f862fe110262dd6eae2f4;Path=/;HttpOnly;Domain=worldclockapi.com"
						],
						"Vary": [
							"Accept-Encoding"
						],
						"X-Aspnet-Version": [
							"4.0.30319"
						],
						"X-Powered-By": [
							"ASP.NET"
						]
					},
					"templated": false,
					"transitionsState": {
						"sequence:2": "2"
					}
				}
			},
			{
				"request": {
					"path": [
						{
							"matcher": "exact",
							"value": "/api/json/est/now"
						}
					],
					"method": [
						{
							"matcher": "exact",
							"value": "GET"
						}
					],
					"destination": [
						{
							"matcher": "exact",
							"value": "worldclockapi.com"
						}
					],
					"scheme": [
						{
							"matcher": "exact",
							"value": "http"
						}
					],
					"body": [
						{
							"matcher": "exact",
							"value": ""
						}
					],
					"query": {},
					"requiresState": {
						"sequence:2": "2"
					}
				},
				"response": {
					"status": 200,
					"body": "{\"$id\":\"1\",\"currentDateTime\":\"2018-08-21T18:35-04:00\",\"utcOffset\":\"-04:00:00\",\"isDayLightSavingsTime\":true,\"dayOfTheWeek\":\"Tuesday\",\"timeZoneName\":\"Eastern Standard Time\",\"currentFileTime\":131793501379138147,\"ordinalDate\":\"2018-233\",\"serviceResponse\":null}",
					"encodedBody": false,
					"headers": {
						"Cache-Control": [
							"no-cache"
						],
						"Content-Length": [
							"256"
						],
						"Content-Type": [
							"application/json; charset=utf-8"
						],
						"Date": [
							"Tue, 21 Aug 2018 22:35:37 GMT"
						],
						"Expires": [
							"-1"
						],
						"Hoverfly": [
							"Was-Here"
						],
						"Pragma": [
							"no-cache"
						],
						"Server": [
							"Microsoft-IIS/10.0"
						],
						"Set-Cookie": [
							"ARRAffinity=1d862f171f4d2e99f1ec9f1b7b37938eb01768c6c51f862fe110262dd6eae2f4;Path=/;HttpOnly;Domain=worldclockapi.com"
						],
						"Vary": [
							"Accept-Encoding"
						],
						"X-Aspnet-Version": [
							"4.0.30319"
						],
						"X-Powered-By": [
							"ASP.NET"
						]
					},
					"templated": false
				}
			},
			{
				"request": {
					"path": [
						{
							"matcher": "exact",
							"value": "/api/json/pst/now"
						}
					],
					"method": [
						{
							"matcher": "exact",
							"value": "GET"
						}
					],
					"destination": [
						{
							"matcher": "exact",
							"value": "worldclockapi.com"
						}
					],
					"scheme": [
						{
							"matcher": "exact",
							"value": "http"
						}
					],
					"body": [
						{
							"matcher": "exact",
							"value": ""
						}
					],
					"query": {},
					"requiresState": {
						"sequence:1": "1"
					}
				},
				"response": {
					"status": 200,
					"body": "{\"$id\":\"1\",\"currentDateTime\":\"2018-08-21T15:35-07:00\",\"utcOffset\":\"-07:00:00\",\"isDayLightSavingsTime\":true,\"dayOfTheWeek\":\"Tuesday\",\"timeZoneName\":\"Pacific Standard Time\",\"currentFileTime\":131793393549751631,\"ordinalDate\":\"2018-233\",\"serviceResponse\":null}",
					"encodedBody": false,
					"headers": {
						"Cache-Control": [
							"no-cache"
						],
						"Content-Length": [
							"256"
						],
						"Content-Type": [
							"application/json; charset=utf-8"
						],
						"Date": [
							"Tue, 21 Aug 2018 22:35:54 GMT"
						],
						"Expires": [
							"-1"
						],
						"Hoverfly": [
							"Was-Here"
						],
						"Pragma": [
							"no-cache"
						],
						"Server": [
							"Microsoft-IIS/10.0"
						],
						"Set-Cookie": [
							"ARRAffinity=1d862f171f4d2e99f1ec9f1b7b37938eb01768c6c51f862fe110262dd6eae2f4;Path=/;HttpOnly;Domain=worldclockapi.com"
						],
						"Vary": [
							"Accept-Encoding"
						],
						"X-Aspnet-Version": [
							"4.0.30319"
						],
						"X-Powered-By": [
							"ASP.NET"
						]
					},
					"templated": false,
					"transitionsState": {
						"sequence:1": "2"
					}
				}
			},
			{
				"request": {
					"path": [
						{
							"matcher": "exact",
							"value": "/api/json/pst/now"
						}
					],
					"method": [
						{
							"matcher": "exact",
							"value": "GET"
						}
					],
					"destination": [
						{
							"matcher": "exact",
							"value": "worldclockapi.com"
						}
					],
					"scheme": [
						{
							"matcher": "exact",
							"value": "http"
						}
					],
					"body": [
						{
							"matcher": "exact",
							"value": ""
						}
					],
					"query": {},
					"requiresState": {
						"sequence:1": "2"
					}
				},
				"response": {
					"status": 200,
					"body": "{\"$id\":\"1\",\"currentDateTime\":\"2018-08-21T15:35-07:00\",\"utcOffset\":\"-07:00:00\",\"isDayLightSavingsTime\":true,\"dayOfTheWeek\":\"Tuesday\",\"timeZoneName\":\"Pacific Standard Time\",\"currentFileTime\":131793393570984978,\"ordinalDate\":\"2018-233\",\"serviceResponse\":null}",
					"encodedBody": false,
					"headers": {
						"Cache-Control": [
							"no-cache"
						],
						"Content-Length": [
							"256"
						],
						"Content-Type": [
							"application/json; charset=utf-8"
						],
						"Date": [
							"Tue, 21 Aug 2018 22:35:56 GMT"
						],
						"Expires": [
							"-1"
						],
						"Hoverfly": [
							"Was-Here"
						],
						"Pragma": [
							"no-cache"
						],
						"Server": [
							"Microsoft-IIS/10.0"
						],
						"Set-Cookie": [
							"ARRAffinity=1d862f171f4d2e99f1ec9f1b7b37938eb01768c6c51f862fe110262dd6eae2f4;Path=/;HttpOnly;Domain=worldclockapi.com"
						],
						"Vary": [
							"Accept-Encoding"
						],
						"X-Aspnet-Version": [
							"4.0.30319"
						],
						"X-Powered-By": [
							"ASP.NET"
						]
					},
					"templated": false
				}
			}
		],
		"globalActions": {
			"delays": []
		}
	},
	"meta": {
		"schemaVersion": "v5",
		"hoverflyVersion": "v0.17.3",
		"timeExported": "2018-08-21T15:36:18-07:00"
	}
}

@benjih
Copy link
Contributor

benjih commented Aug 23, 2018

Can confirm this is a bug but @john4744 has already found the issue and submitted a fix. This fix should be included in v0.17.4.

@benjih benjih removed their assignment Aug 23, 2018
benjih added a commit that referenced this issue Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants