Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
bs are not namespaced
Browse files Browse the repository at this point in the history
  • Loading branch information
oksana-grishchenko committed Feb 9, 2024
1 parent c9e9120 commit be86c92
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions api-tests/tests/backup-storages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test('add/list/get/delete s3 backup storage success', async ({request}) => {
secretKey: 'sdfsdfsd',
}

const response = await request.post(`/v1/namespaces/${testsNs}/backup-storages`, {
const response = await request.post(`/v1/backup-storages`, {
data: payload,
})

Expand All @@ -45,15 +45,15 @@ test('add/list/get/delete s3 backup storage success', async ({request}) => {
expect(created.description).toBe(payload.description)

// list
const listResponse = await request.get(`/v1/namespaces/${testsNs}/backup-storages`)
const listResponse = await request.get(`/v1/backup-storages`)

expect(listResponse.ok()).toBeTruthy()
const list = await listResponse.json()

expect(list.length).toBeGreaterThan(0)

// get
const one = await request.get(`/v1/namespaces/${testsNs}/backup-storages${name}`)
const one = await request.get(`/v1/backup-storages${name}`)

expect(one.ok()).toBeTruthy()
expect((await one.json()).name).toBe(payload.name)
Expand All @@ -65,7 +65,7 @@ test('add/list/get/delete s3 backup storage success', async ({request}) => {
accessKey: 'otherAccessKey',
secretKey: 'otherSecret',
}
const updated = await request.patch(`/v1/namespaces/${testsNs}/backup-storages/${name}`, {
const updated = await request.patch(`/v1/backup-storages/${name}`, {
data: updatePayload,
})

Expand All @@ -78,14 +78,14 @@ test('add/list/get/delete s3 backup storage success', async ({request}) => {
expect(result.description).toBe(updatePayload.description)

// backup storage already exists
const createAgain = await request.post(`/v1/namespaces/${testsNs}/backup-storages`, {
const createAgain = await request.post(`/v1/backup-storages`, {
data: payload,
})

expect(createAgain.status()).toBe(409)

// delete
const deleted = await request.delete(`/v1/namespaces/${testsNs}/backup-storages/${name}`)
const deleted = await request.delete(`/v1/backup-storages/${name}`)

expect(deleted.ok()).toBeTruthy()
})
Expand All @@ -100,7 +100,7 @@ test('add/list/get/delete azure backup storage success', async ({request}) => {
secretKey: 'sdfsdfsd',
}

const response = await request.post(`/v1/namespaces/${testsNs}/backup-storages`, {
const response = await request.post(`/v1/backup-storages`, {
data: payload,
})

Expand All @@ -116,15 +116,15 @@ test('add/list/get/delete azure backup storage success', async ({request}) => {
expect(created.description).toBe(payload.description)

// list
const listResponse = await request.get(`/v1/namespaces/${testsNs}/backup-storages`)
const listResponse = await request.get(`/v1/backup-storages`)

expect(listResponse.ok()).toBeTruthy()
const list = await listResponse.json()

expect(list.length).toBeGreaterThan(0)

// get
const one = await request.get(`/v1/namespaces/${testsNs}/backup-storages/${name}`)
const one = await request.get(`/v1/backup-storages/${name}`)

expect(one.ok()).toBeTruthy()
expect((await one.json()).name).toBe(payload.name)
Expand All @@ -134,7 +134,7 @@ test('add/list/get/delete azure backup storage success', async ({request}) => {
description: 'some description',
bucketName: 'percona-test-backup-storage1',
}
const updated = await request.patch(`/v1/namespaces/${testsNs}/backup-storages/${name}`, {
const updated = await request.patch(`/v1/backup-storages/${name}`, {
data: updatePayload,
})

Expand All @@ -147,14 +147,14 @@ test('add/list/get/delete azure backup storage success', async ({request}) => {
expect(result.description).toBe(updatePayload.description)

// backup storage already exists
const createAgain = await request.post(`/v1/namespaces/${testsNs}/backup-storages`, {
const createAgain = await request.post(`/v1/backup-storages`, {
data: payload,
})

expect(createAgain.status()).toBe(409)

// delete
const deleted = await request.delete(`/v1/namespaces/${testsNs}/backup-storages/${name}`)
const deleted = await request.delete(`/v1/backup-storages/${name}`)

expect(deleted.ok()).toBeTruthy()
})
Expand Down Expand Up @@ -222,7 +222,7 @@ test('create backup storage failures', async ({request}) => {
]

for (const testCase of testCases) {
const response = await request.post(`/v1/namespaces/${testsNs}/backup-storages`, {
const response = await request.post(`/v1/backup-storages`, {
data: testCase.payload,
})

Expand All @@ -240,7 +240,7 @@ test('update backup storage failures', async ({request}) => {
accessKey: 'sdfsdfs',
secretKey: 'lkdfslsldfka',
}
const response = await request.post(`/v1/namespaces/${testsNs}/backup-storages`, {
const response = await request.post(`/v1/backup-storages`, {
data: createPayload,
})

Expand All @@ -265,23 +265,23 @@ test('update backup storage failures', async ({request}) => {
]

for (const testCase of testCases) {
const response = await request.patch(`/v1/namespaces/${testsNs}/backup-storages/${name}`, {
const response = await request.patch(`/v1/backup-storages/${name}`, {
data: testCase.payload,
})

expect((await response.json()).message).toMatch(testCase.errorText)
expect(response.status()).toBe(400)
}

const deleted = await request.delete(`/v1/namespaces/${testsNs}/backup-storages/${name}`)
const deleted = await request.delete(`/v1/backup-storages/${name}`)

expect(deleted.ok()).toBeTruthy()
})

test('update: backup storage not found', async ({request}) => {
const name = 'some-storage'

const response = await request.patch(`/v1/namespaces/${testsNs}/backup-storages/${name}`, {
const response = await request.patch(`/v1/backup-storages/${name}`, {
data: {
bucketName: 's3',
},
Expand All @@ -293,14 +293,14 @@ test('update: backup storage not found', async ({request}) => {
test('delete: backup storage not found', async ({request}) => {
const name = 'backup-storage'

const response = await request.delete(`/v1/namespaces/${testsNs}/backup-storages/${name}`)
const response = await request.delete(`/v1/backup-storages/${name}`)

expect(response.status()).toBe(404)
})

test('get: backup storage not found', async ({request}) => {
const name = 'backup-storage'
const response = await request.get(`/v1/namespaces/${testsNs}/backup-storages/${name}`)
const response = await request.get(`/v1/backup-storages/${name}`)

expect(response.status()).toBe(404)
})
4 changes: 2 additions & 2 deletions api-tests/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ export const createBackupStorage = async (request, name) => {
secretKey: 'sdfsdfsd',
}

const response = await request.post(`/v1/namespaces/${testsNs}/backup-storages`, { data: storagePayload })
const response = await request.post(`/v1/backup-storages`, { data: storagePayload })

expect(response.ok()).toBeTruthy()
}

export const deleteBackupStorage = async (request, name) => {
const res = await request.delete(`/v1/namespaces/${testsNs}/backup-storages/${name}`)
const res = await request.delete(`/v1/backup-storages/${name}`)

expect(res.ok()).toBeTruthy()
}
Expand Down

0 comments on commit be86c92

Please sign in to comment.