Fix issues with parallel tests and self/cloud modes
This commit is contained in:
parent
6d07a0371a
commit
7027abeaa2
|
@ -361,8 +361,8 @@ export const deleteFolder = async (
|
||||||
Prefix: folder,
|
Prefix: folder,
|
||||||
}
|
}
|
||||||
|
|
||||||
let response: any = await client.listObjects(listParams).promise()
|
const existingObjectsResponse = await client.listObjects(listParams).promise()
|
||||||
if (response.Contents.length === 0) {
|
if (existingObjectsResponse.Contents?.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const deleteParams: any = {
|
const deleteParams: any = {
|
||||||
|
@ -372,13 +372,13 @@ export const deleteFolder = async (
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
response.Contents.forEach((content: any) => {
|
existingObjectsResponse.Contents?.forEach((content: any) => {
|
||||||
deleteParams.Delete.Objects.push({ Key: content.Key })
|
deleteParams.Delete.Objects.push({ Key: content.Key })
|
||||||
})
|
})
|
||||||
|
|
||||||
response = await client.deleteObjects(deleteParams).promise()
|
const deleteResponse = await client.deleteObjects(deleteParams).promise()
|
||||||
// can only empty 1000 items at once
|
// can only empty 1000 items at once
|
||||||
if (response.Deleted.length === 1000) {
|
if (deleteResponse.Deleted?.length === 1000) {
|
||||||
return deleteFolder(bucketName, folder)
|
return deleteFolder(bucketName, folder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ module AwsMock {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.listObjects = jest.fn(
|
this.listObjects = jest.fn(
|
||||||
response({
|
response({
|
||||||
Contents: {},
|
Contents: [],
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ describe("/static", () => {
|
||||||
afterAll(setup.afterAll)
|
afterAll(setup.afterAll)
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
config.modeSelf()
|
||||||
app = await config.init()
|
app = await config.init()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ describe("/webhooks", () => {
|
||||||
afterAll(setup.afterAll)
|
afterAll(setup.afterAll)
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
config.modeSelf()
|
||||||
await config.init()
|
await config.init()
|
||||||
const autoConfig = basicAutomation()
|
const autoConfig = basicAutomation()
|
||||||
autoConfig.definition.trigger = {
|
autoConfig.definition.trigger = {
|
||||||
|
|
|
@ -41,7 +41,7 @@ describe("test the execute query action", () => {
|
||||||
query: { queryId: "wrong_id" }
|
query: { queryId: "wrong_id" }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
expect(res.response).toEqual('{"status":404,"name":"not_found","message":"missing","reason":"missing"}')
|
expect(res.response).toEqual('Error: missing')
|
||||||
expect(res.success).toEqual(false)
|
expect(res.success).toEqual(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue