Skip to content

Commit

Permalink
tests: fix mock data for streaming usecases #449
Browse files Browse the repository at this point in the history
  • Loading branch information
maany committed Aug 14, 2024
1 parent 94c8695 commit 66b7642
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
21 changes: 6 additions & 15 deletions test/api/did/list-dids-stream-error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Readable } from 'stream'
import { MockHttpStreamableResponseFactory } from 'test/fixtures/http-fixtures'
import MockRucioServerFactory, { MockEndpoint } from 'test/fixtures/rucio-server'

describe('DID API Tests', () => {
describe('DID API Tests #2', () => {
beforeEach(() => {
fetchMock.doMock()
const listDIDsEndpoint: MockEndpoint = {
Expand All @@ -22,10 +22,11 @@ describe('DID API Tests', () => {
},
body: Readable.from(
[
'"dataset1"',
'"dataset2"',
'"dataset3"',
" "
'"dataset1"\n',
'"dataset2"\n',
'"dataset3"\n',
" ",
" ",
].join('\n'),
),
},
Expand Down Expand Up @@ -170,16 +171,6 @@ describe('DID API Tests', () => {
"bytes": 456,
"length": 789,
"open": true,
},
{
"status": "error",
"name": "Gateway Error: Undefined DID in stream",
"message": "Gateway recieved an invalid (undefined) DID for the query",
"scope": "",
"did_type": "Unknown",
"bytes": 0,
"length": 0,
"open": false,
}
])
})
Expand Down
6 changes: 3 additions & 3 deletions test/api/did/list-dids.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ describe('DID API Tests', () => {
},
body: Readable.from(
[
'"dataset1"',
'"dataset2"',
'"dataset3"',
'"dataset1"\n',
'"dataset2"\n',
'"dataset3"\n',
].join('\n'),
),
},
Expand Down
2 changes: 1 addition & 1 deletion test/gateway/account/list-account-rse-usage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Account Gateway : List RSE Usage for an account', () => {
JSON.stringify({"rse_id": "5883a989c9c047d99d2fc1c074e40f58", "rse": "XRD4", "bytes": 300, "files": 6, "bytes_limit": 700, "bytes_remaining": 400}),
JSON.stringify({"rse_id": "2bb03a45a1b64b459cdc445d9844d936", "rse": "XRD3", "bytes": 400, "files": 7, "bytes_limit": 600, "bytes_remaining": 200}),
JSON.stringify({"rse_id": "72fb4137ba3c460090bbd3fd8d490f8b", "rse": "XRD1", "bytes": 500, "files": 8, "bytes_limit": Infinity, "bytes_remaining": Infinity}),
].join('\n'))
].join('\n') + '\n');

const listAccountRSEUsageEndpoint: MockEndpoint = {
url: `${MockRucioServerFactory.RUCIO_HOST}/accounts/root/usage`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ describe("RuleGateway", () => {
"rse": "XRD3",
"state": "REPLICATING",
"rule_id": "0dcdc93fab714f8b84bad116c409483b"
}),
}) + '\n',
JSON.stringify({
"scope": "test",
"name": "file2",
"rse_id": "e815ec46bfa2427cac191cc36ac94527",
"rse": "XRD3",
"state": "REPLICATING",
"rule_id": "0dcdc93fab714f8b84bad116c409483b"
}),
}) + '\n',
JSON.stringify({
"scope": "test",
"name": "file3",
"rse_id": "e815ec46bfa2427cac191cc36ac94527",
"rse": "XRD3",
"state": "REPLICATING",
"rule_id": "0dcdc93fab714f8b84bad116c409483b"
}),
}) + '\n',
JSON.stringify({
"scope": "test",
"name": "file4",
"rse_id": "e815ec46bfa2427cac191cc36ac94527",
"rse": "XRD3",
"state": "REPLICATING",
"rule_id": "0dcdc93fab714f8b84bad116c409483b"
})
}) + '\n'
])

const listRuleReplicaLockStatesEndpoint: MockEndpoint = {
Expand Down

0 comments on commit 66b7642

Please sign in to comment.