Skip to content

Commit

Permalink
Fix tests running in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mksh committed Apr 27, 2023
1 parent b6f6a89 commit 9170729
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 35 deletions.
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ services:
image: docker.io/kennethreitz/httpbin:latest
ports:
- '38282:80'
networks:
static-network:
ipv4_address: 172.21.93.93
networks:
static-network:
ipam:
config:
- subnet: 172.21.0.0/16
1 change: 1 addition & 0 deletions tests/integration/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ async fn send_and_compare(
let mut vcr_headers = vcr_response.headers().clone();
let mut real_headers = real_response.headers().clone();

// Server date is different for recorded and live requests
vcr_headers.remove("date".to_string());
real_headers.remove("date".to_string());

Expand Down
70 changes: 35 additions & 35 deletions tests/resources/test.vcr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"response": {
"body": {
"encoding": null,
"string": "{\n \"args\": {}, \n \"headers\": {\n \"Accept\": \"application/json\", \n \"Host\": \"127.0.0.1:38282\"\n }, \n \"origin\": \"172.19.0.1\", \n \"url\": \"http://127.0.0.1:38282/get\"\n}\n"
"string": "{\n \"args\": {}, \n \"headers\": {\n \"Accept\": \"application/json\", \n \"Host\": \"127.0.0.1:38282\"\n }, \n \"origin\": \"172.21.0.1\", \n \"url\": \"http://127.0.0.1:38282/get\"\n}\n"
},
"http_version": "1.1",
"status": {
Expand All @@ -15,23 +15,23 @@
"access-control-allow-credentials": [
"true"
],
"server": [
"gunicorn/19.9.0"
],
"access-control-allow-origin": [
"*"
],
"connection": [
"keep-alive"
],
"server": [
"gunicorn/19.9.0"
],
"content-length": [
"170"
],
"content-type": [
"application/json"
],
"connection": [
"keep-alive"
],
"date": [
"Thu, 27 Apr 2023 00:53:14 GMT"
"Thu, 27 Apr 2023 02:21:55 GMT"
]
}
},
Expand All @@ -48,40 +48,40 @@
]
}
},
"recorded_at": "Thu, 27 Apr 2023 00:53:14 +0000"
"recorded_at": "Thu, 27 Apr 2023 02:21:55 +0000"
},
{
"response": {
"body": {
"encoding": null,
"string": "{\n \"args\": {}, \n \"data\": \"test1\", \n \"files\": {}, \n \"form\": {}, \n \"headers\": {\n \"Accept\": \"application/json\", \n \"Content-Length\": \"5\", \n \"Host\": \"127.0.0.1:38282\"\n }, \n \"json\": null, \n \"origin\": \"172.19.0.1\", \n \"url\": \"http://127.0.0.1:38282/post\"\n}\n"
"string": "{\n \"args\": {}, \n \"data\": \"test1\", \n \"files\": {}, \n \"form\": {}, \n \"headers\": {\n \"Accept\": \"application/json\", \n \"Content-Length\": \"5\", \n \"Host\": \"127.0.0.1:38282\"\n }, \n \"json\": null, \n \"origin\": \"172.21.0.1\", \n \"url\": \"http://127.0.0.1:38282/post\"\n}\n"
},
"http_version": "1.1",
"status": {
"code": 200,
"message": "OK"
},
"headers": {
"connection": [
"keep-alive"
"server": [
"gunicorn/19.9.0"
],
"date": [
"Thu, 27 Apr 2023 00:53:14 GMT"
"Thu, 27 Apr 2023 02:21:55 GMT"
],
"content-type": [
"application/json"
],
"server": [
"gunicorn/19.9.0"
"connection": [
"keep-alive"
],
"access-control-allow-origin": [
"*"
],
"content-length": [
"267"
"content-type": [
"application/json"
],
"access-control-allow-credentials": [
"true"
],
"content-length": [
"267"
]
}
},
Expand All @@ -98,40 +98,40 @@
]
}
},
"recorded_at": "Thu, 27 Apr 2023 00:53:14 +0000"
"recorded_at": "Thu, 27 Apr 2023 02:21:55 +0000"
},
{
"response": {
"body": {
"encoding": null,
"string": "{\n \"args\": {}, \n \"data\": \"test2\", \n \"files\": {}, \n \"form\": {}, \n \"headers\": {\n \"Accept\": \"application/json\", \n \"Content-Length\": \"5\", \n \"Host\": \"127.0.0.1:38282\"\n }, \n \"json\": null, \n \"origin\": \"172.19.0.1\", \n \"url\": \"http://127.0.0.1:38282/post\"\n}\n"
"string": "{\n \"args\": {}, \n \"data\": \"test2\", \n \"files\": {}, \n \"form\": {}, \n \"headers\": {\n \"Accept\": \"application/json\", \n \"Content-Length\": \"5\", \n \"Host\": \"127.0.0.1:38282\"\n }, \n \"json\": null, \n \"origin\": \"172.21.0.1\", \n \"url\": \"http://127.0.0.1:38282/post\"\n}\n"
},
"http_version": "1.1",
"status": {
"code": 200,
"message": "OK"
},
"headers": {
"content-length": [
"267"
],
"date": [
"Thu, 27 Apr 2023 00:53:14 GMT"
"Thu, 27 Apr 2023 02:21:55 GMT"
],
"access-control-allow-credentials": [
"true"
"connection": [
"keep-alive"
],
"access-control-allow-origin": [
"*"
"content-type": [
"application/json"
],
"server": [
"gunicorn/19.9.0"
],
"content-type": [
"application/json"
"access-control-allow-origin": [
"*"
],
"connection": [
"keep-alive"
"content-length": [
"267"
],
"access-control-allow-credentials": [
"true"
]
}
},
Expand All @@ -148,7 +148,7 @@
]
}
},
"recorded_at": "Thu, 27 Apr 2023 00:53:14 +0000"
"recorded_at": "Thu, 27 Apr 2023 02:21:55 +0000"
}
],
"recorded_with": "rVCR 0.1.0"
Expand Down

0 comments on commit 9170729

Please sign in to comment.