[misc] test/acceptance: retrieve ingress metrics just before using it

The upload request can bump the ingress metric.
The content hash validation might require a full download
in case the ETag field of the upload response is not a md5 sum.
This commit is contained in:
Jakob Ackermann 2020-02-28 12:27:06 +01:00
parent 516102e6fb
commit 2b9d0868c5

View file

@ -148,12 +148,8 @@ describe('Filestore', function() {
})
beforeEach(async function() {
// retrieve previous metrics from the app
if (Settings.filestore.backend === 's3') {
;[previousEgress, previousIngress] = await Promise.all([
getMetric(filestoreUrl, 's3_egress'),
getMetric(filestoreUrl, 's3_ingress')
])
previousEgress = await getMetric(filestoreUrl, 's3_egress')
}
projectId = `acceptance_tests_${Math.random()}`
})
@ -195,6 +191,15 @@ describe('Filestore', function() {
await pipeline(readStream, writeStream, resultStream)
})
beforeEach(async function retrievePreviousIngressMetrics() {
// The upload request can bump the ingress metric.
// The content hash validation might require a full download
// in case the ETag field of the upload response is not a md5 sum.
if (Settings.filestore.backend === 's3') {
previousIngress = await getMetric(filestoreUrl, 's3_ingress')
}
})
it('should return 404 for a non-existant id', async function() {
const options = { uri: fileUrl + '___this_is_clearly_wrong___' }
await expect(