Skip to content

Commit 66b7642

Browse files
committed
tests: fix mock data for streaming usecases #449
1 parent 94c8695 commit 66b7642

4 files changed

+14
-23
lines changed

test/api/did/list-dids-stream-error.test.ts

+6-15
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Readable } from 'stream'
88
import { MockHttpStreamableResponseFactory } from 'test/fixtures/http-fixtures'
99
import MockRucioServerFactory, { MockEndpoint } from 'test/fixtures/rucio-server'
1010

11-
describe('DID API Tests', () => {
11+
describe('DID API Tests #2', () => {
1212
beforeEach(() => {
1313
fetchMock.doMock()
1414
const listDIDsEndpoint: MockEndpoint = {
@@ -22,10 +22,11 @@ describe('DID API Tests', () => {
2222
},
2323
body: Readable.from(
2424
[
25-
'"dataset1"',
26-
'"dataset2"',
27-
'"dataset3"',
28-
" "
25+
'"dataset1"\n',
26+
'"dataset2"\n',
27+
'"dataset3"\n',
28+
" ",
29+
" ",
2930
].join('\n'),
3031
),
3132
},
@@ -170,16 +171,6 @@ describe('DID API Tests', () => {
170171
"bytes": 456,
171172
"length": 789,
172173
"open": true,
173-
},
174-
{
175-
"status": "error",
176-
"name": "Gateway Error: Undefined DID in stream",
177-
"message": "Gateway recieved an invalid (undefined) DID for the query",
178-
"scope": "",
179-
"did_type": "Unknown",
180-
"bytes": 0,
181-
"length": 0,
182-
"open": false,
183174
}
184175
])
185176
})

test/api/did/list-dids.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ describe('DID API Tests', () => {
2222
},
2323
body: Readable.from(
2424
[
25-
'"dataset1"',
26-
'"dataset2"',
27-
'"dataset3"',
25+
'"dataset1"\n',
26+
'"dataset2"\n',
27+
'"dataset3"\n',
2828
].join('\n'),
2929
),
3030
},

test/gateway/account/list-account-rse-usage.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Account Gateway : List RSE Usage for an account', () => {
1515
JSON.stringify({"rse_id": "5883a989c9c047d99d2fc1c074e40f58", "rse": "XRD4", "bytes": 300, "files": 6, "bytes_limit": 700, "bytes_remaining": 400}),
1616
JSON.stringify({"rse_id": "2bb03a45a1b64b459cdc445d9844d936", "rse": "XRD3", "bytes": 400, "files": 7, "bytes_limit": 600, "bytes_remaining": 200}),
1717
JSON.stringify({"rse_id": "72fb4137ba3c460090bbd3fd8d490f8b", "rse": "XRD1", "bytes": 500, "files": 8, "bytes_limit": Infinity, "bytes_remaining": Infinity}),
18-
].join('\n'))
18+
].join('\n') + '\n');
1919

2020
const listAccountRSEUsageEndpoint: MockEndpoint = {
2121
url: `${MockRucioServerFactory.RUCIO_HOST}/accounts/root/usage`,

test/gateway/rule/rule-gateway-list-rule-replica-lock-states.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,31 @@ describe("RuleGateway", () => {
1818
"rse": "XRD3",
1919
"state": "REPLICATING",
2020
"rule_id": "0dcdc93fab714f8b84bad116c409483b"
21-
}),
21+
}) + '\n',
2222
JSON.stringify({
2323
"scope": "test",
2424
"name": "file2",
2525
"rse_id": "e815ec46bfa2427cac191cc36ac94527",
2626
"rse": "XRD3",
2727
"state": "REPLICATING",
2828
"rule_id": "0dcdc93fab714f8b84bad116c409483b"
29-
}),
29+
}) + '\n',
3030
JSON.stringify({
3131
"scope": "test",
3232
"name": "file3",
3333
"rse_id": "e815ec46bfa2427cac191cc36ac94527",
3434
"rse": "XRD3",
3535
"state": "REPLICATING",
3636
"rule_id": "0dcdc93fab714f8b84bad116c409483b"
37-
}),
37+
}) + '\n',
3838
JSON.stringify({
3939
"scope": "test",
4040
"name": "file4",
4141
"rse_id": "e815ec46bfa2427cac191cc36ac94527",
4242
"rse": "XRD3",
4343
"state": "REPLICATING",
4444
"rule_id": "0dcdc93fab714f8b84bad116c409483b"
45-
})
45+
}) + '\n'
4646
])
4747

4848
const listRuleReplicaLockStatesEndpoint: MockEndpoint = {

0 commit comments

Comments
 (0)