Skip to content

Conversation

@BentiGorlich
Copy link
Member

  • add the missing cascade deletes to the foreign keys of NotificationSettings

@BentiGorlich BentiGorlich added bug Something isn't working backend Backend related issues and pull requests labels Feb 3, 2025
@BentiGorlich BentiGorlich self-assigned this Feb 3, 2025
@BentiGorlich
Copy link
Member Author

I have no idea why the tests are failing... I doubt that it has anything to do with the changes...

@melroy89
Copy link
Member

melroy89 commented Feb 4, 2025

I have no idea why the tests are failing... I doubt that it has anything to do with the changes...

Seems like some kind of order of execution issue.

Like the db was not emptied? Or at least the test expected the row to be empty. But instead you get:

Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "user_email_idx"
DETAIL: Key (email)=([email protected]) already exists.

@melroy89 melroy89 added this to the v1.8.0 milestone Feb 4, 2025
@BentiGorlich BentiGorlich force-pushed the fix/notification-settings-missing-cascade-delete branch from 7d2764c to c321c37 Compare February 4, 2025 15:56
melroy89
melroy89 previously approved these changes Feb 4, 2025
Copy link
Member

@melroy89 melroy89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the PHP file is added as well. Great! thx

@melroy89
Copy link
Member

melroy89 commented Feb 4, 2025

However.. integration test is still failing consistently. you might want to check that out still. Integration test does not fail on other PRs like: #1426

@melroy89
Copy link
Member

melroy89 commented Feb 4, 2025

I triggered the (integration) tests manually again

EDIT: Both runs are failing:

image

@BentiGorlich
Copy link
Member Author

Well I think the problem is this line:

  1. Exception in third-party event subscriber: There is already an active transaction

Which I also have in the AP PR and I have no idea where that should come from... I cannot reporoduce it locally...
This command runs all tests like in the CI and it just works:
SYMFONY_DEPRECATIONS_HELPER=disabled ./vendor/bin/paratest tests/Unit && php vendor/bin/phpunit tests/Functional --group NonThreadSafe && php vendor/bin/paratest tests/Functional --exclude-group NonThreadSafe

@BentiGorlich
Copy link
Member Author

Normally each test is executed in its own transaction which leads to an isolation, but the error I sent says that that isn't working. I just have no clue as to why

@melroy89
Copy link
Member

melroy89 commented Feb 4, 2025

is it conflicting with other runs like from the main branch maybe? Just thinking out loud here.

@BentiGorlich
Copy link
Member Author

what the actual fuck

@melroy89
Copy link
Member

melroy89 commented Feb 4, 2025

Maybe we need to add try/catch with a rollBack() method. This isn't an error in LoginControllerTest. But maybe in setUp or where does it get triggered?

The HTML response is also not helpful. Maybe we should add the logs as an artifact to GitHub? So you can see the logs. This can be achieved via https://github.com/actions/upload-artifact. And needs to be used via if: always() so also in case the job fails, it will then upload the log file.

@BentiGorlich
Copy link
Member Author

All of the duplicate errors are caused by the transaction wrapping not working due to the error message I linked

Exception in third-party event subscriber: There is already an active transaction

I just have no idea why there would be an active transaction in there...

It seems like it is just the non thread safe integration tests, but still no idea why as I cannot reproduce it locally

@BentiGorlich BentiGorlich force-pushed the fix/notification-settings-missing-cascade-delete branch from a24263b to bff3a74 Compare February 5, 2025 12:18
- add the missing cascade deletes to the foreign keys of NotificationSettings
@BentiGorlich BentiGorlich force-pushed the fix/notification-settings-missing-cascade-delete branch from bff3a74 to 0c8b68c Compare February 5, 2025 13:42
@melroy89
Copy link
Member

melroy89 commented Feb 5, 2025

What about creating a new branch? And try again. And see when the integration test fails..? Unless you already know the root cause.

@BentiGorlich
Copy link
Member Author

I did :( #1429 #1428

@BentiGorlich
Copy link
Member Author

It is definitely the migration, I just don't know why...

@melroy89
Copy link
Member

melroy89 commented Feb 5, 2025

While the migration actually fixes the problem. Could it be that some integration test is expecting some data to be present but now gets deleted due to this migration delete cascade fix?

@BentiGorlich
Copy link
Member Author

I'm 100% certain that the cause of all the errors is that the DB isolation that the doctrine test bundle is supposed to do is not working, because there already is a transaction in every of the test cases... I have no idea where that would be coming from and I tried to put every beginTransaction that we are calling behind an if so that it is not executed in the test environment which also didn't help... I added a commit and a close connection to the bootstrap which also did nothing... I am clueless where this other transaction would be coming from...

@melroy89
Copy link
Member

melroy89 commented Feb 8, 2025

...Rebasing trying the new docker image now..

@melroy89 melroy89 enabled auto-merge (squash) February 8, 2025 14:30
@melroy89 melroy89 merged commit 013a212 into main Feb 8, 2025
7 checks passed
@melroy89 melroy89 deleted the fix/notification-settings-missing-cascade-delete branch February 8, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend related issues and pull requests bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants