Description:
The CI job for the GroupsController has encountered the following issues:
Database Deadlock:
Deadlocks were observed in the GroupUsers table during deletion operations.
Likely caused by concurrent transactions acquiring locks in different orders.
Flaky Test in GroupsController:
The test should stop regular users and others from updating a group failed intermittently.
This might occur due to reliance on shared database state and improper isolation.
Duplicate Key Violation:
A duplicate key error was observed on the Users_email_key constraint.
Indicates that the database state is not properly reset between tests.
Proposed Solutions:
- Fix Deadlocks:
Ensure consistent locking order and use explicit transactions.
Example:
await this.databaseService.sequelize.transaction(async (transaction) => {
await this.groupUserModel.destroy({ where: { groupId }, transaction });
});
- Improve Test Isolation:
Reset the database state properly in beforeEach() hooks.
Example:
beforeEach(async () => {
await databaseService.cleanAll();
basicUser = await usersService.create(CREATE_USER_DTO_TEST_OBJ);
});
- Handle Duplicate Key Errors:
Use UPSERT or check for existing records before insertion.
Example:
await this.userModel.upsert({ email: 'example@example.com' }, { conflictFields: ['email'] });
- Improve Test Assertions:
Ensure the ForbiddenError is reliably thrown and validated.
Example:
await expect(
groupsController.update({ user: basicUser }, privateGroup.id, UPDATE_GROUP)
).rejects.toThrow('You do not have permission to update this group');
Additional Context:
The failure logs can be found here.
Description:
The CI job for the GroupsController has encountered the following issues:
Database Deadlock:
Deadlocks were observed in the GroupUsers table during deletion operations.
Likely caused by concurrent transactions acquiring locks in different orders.
Flaky Test in
GroupsController:The test should stop regular users and others from updating a group failed intermittently.
This might occur due to reliance on shared database state and improper isolation.
Duplicate Key Violation:
A duplicate key error was observed on the Users_email_key constraint.
Indicates that the database state is not properly reset between tests.
Proposed Solutions:
Ensure consistent locking order and use explicit transactions.
Example:
Reset the database state properly in beforeEach() hooks.
Example:
Use UPSERT or check for existing records before insertion.
Example:
Ensure the ForbiddenError is reliably thrown and validated.
Example:
Additional Context:
The failure logs can be found here.