Skip to content

Commit 87c72ad

Browse files
author
James Browning
committed
Rosetta Deployment Tests
1 parent 3f8eb2b commit 87c72ad

9 files changed

+452
-0
lines changed
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
{
2+
"info": {
3+
"_postman_id": "999b3995-f8e2-48a1-83cf-b7da879a26cf",
4+
"name": "Cardano-Rosetta",
5+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
6+
},
7+
"item": [
8+
{
9+
"name": "data",
10+
"item": [
11+
{
12+
"name": "/network/list",
13+
"event": [
14+
{
15+
"listen": "test",
16+
"script": {
17+
"exec": [
18+
"pm.test(\"Status code is 200\", function () {",
19+
" pm.response.to.have.status(200);",
20+
"});",
21+
"",
22+
"pm.test(\"Body has single network identifier\", function () {",
23+
" const networkId = pm.environment.get(\"networkId\");",
24+
" pm.expect(pm.response.json().network_identifiers).to.have.lengthOf(1);",
25+
"});",
26+
"",
27+
"pm.test(\"Body includes correct blockchain\", function () {",
28+
" const networkId = pm.environment.get(\"networkId\");",
29+
" pm.expect(pm.response.json().network_identifiers[0].blockchain).to.eql(\"cardano\");",
30+
"});",
31+
"",
32+
"pm.test(\"Body includes correct network\", function () {",
33+
" const networkId = pm.environment.get(\"networkId\");",
34+
" pm.expect(pm.response.json().network_identifiers[0].network).to.eql(networkId);",
35+
"});"
36+
],
37+
"type": "text/javascript"
38+
}
39+
}
40+
],
41+
"request": {
42+
"method": "POST",
43+
"header": [],
44+
"body": {
45+
"mode": "raw",
46+
"raw": "{\n}",
47+
"options": {
48+
"raw": {
49+
"language": "json"
50+
}
51+
}
52+
},
53+
"url": {
54+
"raw": "{{URL}}/network/list",
55+
"host": [
56+
"{{URL}}"
57+
],
58+
"path": [
59+
"network",
60+
"list"
61+
]
62+
}
63+
},
64+
"response": []
65+
},
66+
{
67+
"name": "/network/options",
68+
"event": [
69+
{
70+
"listen": "test",
71+
"script": {
72+
"exec": [
73+
"pm.test(\"Status code is 200\", function () {",
74+
" pm.response.to.have.status(200);",
75+
" });",
76+
"",
77+
"pm.test(\"Body includes correct rosetta version\", function () {",
78+
" const rosettaVersion = pm.environment.get(\"rosettaVersion\");",
79+
" pm.expect(pm.response.json().version.rosetta_version).to.eql(rosettaVersion);",
80+
"});"
81+
],
82+
"type": "text/javascript"
83+
}
84+
}
85+
],
86+
"request": {
87+
"method": "POST",
88+
"header": [],
89+
"body": {
90+
"mode": "raw",
91+
"raw": "{\n \"network_identifier\": {\n \"blockchain\": \"cardano\",\n \"network\": \"{{networkId}}\"\n },\n \"metadata\": {}\n}",
92+
"options": {
93+
"raw": {
94+
"language": "json"
95+
}
96+
}
97+
},
98+
"url": {
99+
"raw": "{{URL}}/network/options",
100+
"host": [
101+
"{{URL}}"
102+
],
103+
"path": [
104+
"network",
105+
"options"
106+
]
107+
}
108+
},
109+
"response": []
110+
},
111+
{
112+
"name": "/network/status",
113+
"event": [
114+
{
115+
"listen": "test",
116+
"script": {
117+
"exec": [
118+
"pm.test(\"Body includes correct genesis block\", function () {",
119+
" const genesisBlock = pm.environment.get(\"genesisBlockHash\");",
120+
" pm.expect(pm.response.json().genesis_block_identifier.hash).to.eql(genesisBlock);",
121+
"});"
122+
],
123+
"type": "text/javascript"
124+
}
125+
}
126+
],
127+
"request": {
128+
"method": "POST",
129+
"header": [],
130+
"body": {
131+
"mode": "raw",
132+
"raw": "{\n \"network_identifier\": {\n \"blockchain\": \"cardano\",\n \"network\": \"{{networkId}}\"\n },\n \"metadata\": {}\n}",
133+
"options": {
134+
"raw": {
135+
"language": "json"
136+
}
137+
}
138+
},
139+
"url": {
140+
"raw": "{{URL}}/network/status",
141+
"host": [
142+
"{{URL}}"
143+
],
144+
"path": [
145+
"network",
146+
"status"
147+
]
148+
}
149+
},
150+
"response": []
151+
},
152+
{
153+
"name": "/block",
154+
"event": [
155+
{
156+
"listen": "test",
157+
"script": {
158+
"exec": [
159+
"pm.test(\"Body includes correct block identifier\", function () {",
160+
" const blockIndex = parseInt(pm.environment.get(\"blockIndex\"));",
161+
" const blockHash = pm.environment.get(\"blockHash\");",
162+
" pm.expect(pm.response.json().block.block_identifier.index).to.eql(blockIndex);",
163+
" pm.expect(pm.response.json().block.block_identifier.hash).to.eql(blockHash);",
164+
"});"
165+
],
166+
"type": "text/javascript"
167+
}
168+
}
169+
],
170+
"request": {
171+
"method": "POST",
172+
"header": [],
173+
"body": {
174+
"mode": "raw",
175+
"raw": "{\n \"network_identifier\": {\n \"blockchain\": \"cardano\",\n \"network\": \"{{networkId}}\"\n },\n \"block_identifier\": {\n \"index\": {{blockIndex}},\n \"hash\": \"{{blockHash}}\"\n }\n}",
176+
"options": {
177+
"raw": {
178+
"language": "json"
179+
}
180+
}
181+
},
182+
"url": {
183+
"raw": "{{URL}}/block",
184+
"host": [
185+
"{{URL}}"
186+
],
187+
"path": [
188+
"block"
189+
]
190+
}
191+
},
192+
"response": []
193+
},
194+
{
195+
"name": "/block/transaction",
196+
"event": [
197+
{
198+
"listen": "test",
199+
"script": {
200+
"exec": [
201+
"pm.test(\"Body includes correct transaction identifier\", function () {",
202+
" const transactionId = pm.environment.get(\"transactionId\");",
203+
" pm.expect(pm.response.json().transaction.transaction_identifier.hash).to.eql(transactionId);",
204+
"});",
205+
"",
206+
"pm.test(\"Body includes 1 input and 2 outputs\", function () {",
207+
" pm.expect(pm.response.json().transaction.operations[0].type).to.eql(\"input\");",
208+
" pm.expect(pm.response.json().transaction.operations[1].type).to.eql(\"output\");",
209+
" pm.expect(pm.response.json().transaction.operations[2].type).to.eql(\"output\");",
210+
"});"
211+
],
212+
"type": "text/javascript"
213+
}
214+
}
215+
],
216+
"request": {
217+
"method": "POST",
218+
"header": [],
219+
"body": {
220+
"mode": "raw",
221+
"raw": "{\n \"network_identifier\": {\n \"blockchain\": \"cardano\",\n \"network\": \"{{networkId}}\"\n },\n \"block_identifier\": {\n \"index\": {{blockIndex}},\n \"hash\": \"{{blockHash}}\"\n },\n \"transaction_identifier\": {\n \"hash\": \"{{transactionId}}\"\n }\n}",
222+
"options": {
223+
"raw": {
224+
"language": "json"
225+
}
226+
}
227+
},
228+
"url": {
229+
"raw": "localhost:8081/block/transaction",
230+
"host": [
231+
"localhost"
232+
],
233+
"port": "8081",
234+
"path": [
235+
"block",
236+
"transaction"
237+
]
238+
}
239+
},
240+
"response": []
241+
}
242+
]
243+
}
244+
]
245+
}

deployment-test/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
##Readme
2+
3+
###Steps:
4+
- `npm install newman`
5+
- `nodejs data-deploy-test.js`
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const newman = require('newman');
2+
3+
const environments = [ 'testnet.postman_environment.json',
4+
'shelley-qa.postman_environment.json',
5+
'mary-qa.postman_environment.json',
6+
'staging.postman_environment.json' ]
7+
8+
for (env of environments) {
9+
newman.run({
10+
collection: 'https://www.getpostman.com/collections/681bc379b01e1bf278a6',
11+
environment: require(`./environments/${env}`),
12+
globals: require('./globals.json'),
13+
reporters: ['cli', 'json']
14+
}, function (err) {
15+
if (err) { throw err; }
16+
console.log('collection run complete!');
17+
});
18+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const newman = require('newman');
2+
3+
const envFile = require('some_arg');
4+
const port = 8081;
5+
6+
newman.run({
7+
collection: require('./Cardano-Rosetta.postman_collection.json'),
8+
environment: require(endFile),
9+
envVar: [ { "key":"", "value":`localhost:${port}` } ]
10+
reporters: ['cli', 'json']
11+
}, function (err) {
12+
if (err) { throw err; }
13+
console.log('collection run complete!');
14+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"id": "c2d58415-572d-40db-b857-dc92b202200b",
3+
"name": "mary-qa",
4+
"values": [
5+
{
6+
"key": "URL",
7+
"value": "https://explorer.mary-qa.dev.cardano.org/rosetta",
8+
"enabled": true
9+
},
10+
{
11+
"key": "networkId",
12+
"value": "3",
13+
"enabled": true
14+
},
15+
{
16+
"key": "genesisBlockHash",
17+
"value": "5fabaf2188b1b2a0dde0046ad564ca37c5d92e67b6d7e92da72b2bbc35dfed7e",
18+
"enabled": true
19+
},
20+
{
21+
"key": "blockHash",
22+
"value": "6a09bcaeef2338d595b8a94a895a73a95a13598101f4a217d011d0344f747a84",
23+
"enabled": true
24+
},
25+
{
26+
"key": "blockIndex",
27+
"value": "34684",
28+
"enabled": true
29+
},
30+
{
31+
"key": "transactionId",
32+
"value": "1df7715c572294553204c0b8d0c9077b6d5edbf0f8d6a4ad1146a2ff488a8d0d",
33+
"enabled": true
34+
}
35+
],
36+
"_postman_variable_scope": "environment",
37+
"_postman_exported_at": "2021-02-03T20:27:48.749Z",
38+
"_postman_exported_using": "Postman/7.36.1"
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"id": "39c0c944-d7e4-4ea4-a1cc-9b862ea0f520",
3+
"name": "shelley-qa",
4+
"values": [
5+
{
6+
"key": "URL",
7+
"value": "https://explorer.shelley-qa.dev.cardano.org/rosetta",
8+
"enabled": true
9+
},
10+
{
11+
"key": "networkId",
12+
"value": "3",
13+
"enabled": true
14+
},
15+
{
16+
"key": "genesisBlockHash",
17+
"value": "9325495d3ac7554d4bfaf2392cc3c74676d5add873d6ef8862d7562e660940bf",
18+
"enabled": true
19+
},
20+
{
21+
"key": "blockHash",
22+
"value": "be2aed37b7fffd0c3a472c47deef3dc9f94416634a35a3ce208d15a08341af8a",
23+
"enabled": true
24+
},
25+
{
26+
"key": "blockIndex",
27+
"value": "684048",
28+
"enabled": true
29+
},
30+
{
31+
"key": "transactionId",
32+
"value": "c244afe17beb10797e8432ec9b8749b4b5b6725b4d2959481a9108016051fbd8",
33+
"enabled": true
34+
}
35+
],
36+
"_postman_variable_scope": "environment",
37+
"_postman_exported_at": "2021-02-03T20:27:54.926Z",
38+
"_postman_exported_using": "Postman/7.36.1"
39+
}

0 commit comments

Comments
 (0)