Skip to content

Commit

Permalink
address PR comments: update test scenarios to explicitly check error
Browse files Browse the repository at this point in the history
  • Loading branch information
SiddharthMantri committed Nov 4, 2024
1 parent 58d2b2d commit b84429c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -559,15 +559,9 @@ describe('SavedObjectsRepository Encryption Extension', () => {
...decryptedStrippedAttributes,
});

const result = await bulkCreateSuccess(
client,
repository,
[{ ...encryptedSO, version: mockVersion }],
{
overwrite: true,
// version: mockVersion, // this doesn't work in bulk...looks like it checks the object itself?
}
);
const result = await bulkCreateSuccess(client, repository, [
{ ...encryptedSO, version: mockVersion },
]);

expect(client.bulk).toHaveBeenCalled();
expect(result.saved_objects).not.toBeUndefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ export default function ({ getService }: FtrProviderContext) {
);
});

it('#bulkCreate not enforcing random ID allows to specify ID', async () => {
it('#bulkCreate setting random ID on ESO types that have not opted out throws an error', async () => {
const bulkCreateParams = [
{
type: SAVED_OBJECT_WITH_SECRET_TYPE,
Expand Down Expand Up @@ -1017,8 +1017,12 @@ export default function ({ getService }: FtrProviderContext) {
.expect(200);

expect(savedObjects).to.have.length(bulkCreateParams.length);
expect(savedObjects[0].id).to.be('my_predictable_id');
expect(savedObjects[1].id).to.be('my_predictable_id_2');

savedObjects.forEach((savedObject: any) => {
expect(savedObject.error.message).to.contain(
'Predefined IDs are not allowed for saved objects with encrypted attributes unless the ID is a UUID.'
);
});
});
});
});
Expand Down

0 comments on commit b84429c

Please sign in to comment.