Closed Blackbaud-StewartStephens closed 7 years ago
That's weirding me out, because the mock service doesn't do any parsing of times. It just thinks that's a string. Can you find and post the mock service logs for me?
Sure. Here are the complete contents of the log, after replicating above:
2017-09-01 06:39:43.832 -07:00 [Info] Started http://localhost:60015
2017-09-01 06:39:53.693 -07:00 [Info] Registered expected interaction GET /test
2017-09-01 06:39:53.720 -07:00 [Debug] {
"description": "test",
"provider_state": "test",
"request": {
"method": "get",
"path": "/test"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"datetimeoffset": "2012-12-11T22:11:11-08:00"
}
}
}
After spending a bit more time with this, I'm beginning to think that the issue is actually in pact-net. It turns out that the pact-net nancy server is sitting in between my requests and the pact-mock_server. I think the timezone conversion may occur when the add interaction request is deserialized by pact-net. That would explain why the interactions are registered with the wrong values.
I've confirmed that the issue is related to JSON deserialization in Pact.Net.
I'm running into a strange issue in my pact tests which I believe I have isolated to the pact-mock_service. My service is .NET (C#) and in one of my interactions I setup an interaction with a DateTimeOffset string in the body the timezone of that string is changed (and the time correctly adjusted) when the pact file is written. Because developer machines may run on a different timezone than build machines, this causes issues.
To reproduce this, and eliminate the I called the admin REST endpoints directly. I set the timezone on my machine to Pacific Time (UTC-08:00). After starting the mock service, I made two calls:
First:
POST /interactions
This returned:
200
Added interaction
Then:
POST /pact
This returned:
200
Note that the timezone has been adjusted, although it still refers to the same point in time.
With the mock server still running, I can set my timezone to Eastern Time (UCT-05:00) and call
POST /pact
again and get the same result (timezone adjusted). This suggests that something is happening to the date when the interaction is added.I'm not familiar with Ruby so I wasn't able to debug into the server itself. Does this sound like an issue with the mock service, or am I just doing something wrong?