Added test that secrets are not divulged
Signed-off-by: Erik Larsson <erik.larsson@schibsted.com>
This commit is contained in:
@@ -114,7 +114,7 @@ describe('StorageTaskBroker', () => {
|
||||
expect(taskRow.status).toBe('failed');
|
||||
});
|
||||
|
||||
it('should remove secrets afteer failing a task', async () => {
|
||||
it('should remove secrets after failing a task', async () => {
|
||||
const broker = new StorageTaskBroker(storage, logger);
|
||||
const dispatchResult = await broker.dispatch({} as TaskSpec, fakeSecrets);
|
||||
const task = await broker.claim();
|
||||
|
||||
@@ -301,4 +301,27 @@ describe('createRouter', () => {
|
||||
expect(response.status).toEqual(201);
|
||||
});
|
||||
});
|
||||
|
||||
describe('GET /v2/tasks/:taskId', () => {
|
||||
it('does not divulge secrets', async () => {
|
||||
const postResponse = await request(app)
|
||||
.post('/v2/tasks')
|
||||
.set('Authorization', 'Bearer secret')
|
||||
.send({
|
||||
templateName: 'create-react-app-template',
|
||||
values: {
|
||||
storePath: 'https://github.com/backstage/backstage',
|
||||
component_id: '123',
|
||||
name: 'test',
|
||||
use_typescript: false,
|
||||
},
|
||||
});
|
||||
|
||||
const response = await request(app)
|
||||
.get(`/v2/tasks/${postResponse.body.id}`)
|
||||
.send();
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.body.secrets).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user