GEWIS / sudosos-backend

SudoSOS is a Node.js-based Bar and POS system made for study association GEWIS.
https://sudosos.gewis.nl
GNU Affero General Public License v3.0
6 stars 3 forks source link

[DO NOT MERGE] fix: hanging test suite #291

Closed JustSamuel closed 2 months ago

JustSamuel commented 3 months ago

Description

Test suite seems to hang in the CI, this branch / PR is to test and find out what causes it.

Related issues/external references

Caused in PR #279

Possible targets:

Types of changes

github-actions[bot] commented 3 months ago

SudoSOS Coverage Report

Commit: 6fef8af Base: develop@69bb9d3

Type Base This PR
Total Statements Coverage  85.67%  31.88% (-53.79%)
Total Branches Coverage  84.2%  12.35% (-71.85%)
Total Functions Coverage  87.74%  19.74% (-68%)
Total Lines Coverage  85.84%  30.88% (-54.96%)
Details (changed files)
FileStatementsBranchesFunctionsLines
Details (all files)
FileStatementsBranchesFunctionsLines
/src/index.ts 36.23% 12.5% 0% 37.03%
/src/authentication/token-handler.ts 26.31% 0% 20% 26.31%
/src/controller/authentication-controller.ts 7.73% 0% 0% 7.83%
/src/controller/authentication-secure-controller.ts 23.52% 0% 0% 23.52%
/src/controller/balance-controller.ts 21.95% 0% 0% 21.95%
/src/controller/banner-controller.ts 7.76% 0% 0% 7.76%
/src/controller/base-controller.ts 13.51% 0% 0% 14.7%
/src/controller/container-controller.ts 9.64% 0% 0% 10%
/src/controller/debtor-controller.ts 6.87% 0% 0% 7.25%
/src/controller/event-controller.ts 5.33% 0% 0% 5.33%
/src/controller/event-shift-controller.ts 7.69% 0% 0% 7.69%
/src/controller/invoice-controller.ts 7.69% 0% 0% 7.77%
/src/controller/payout-request-controller.ts 8.41% 0% 0% 8.41%
/src/controller/point-of-sale-controller.ts 8.17% 0% 0% 8.49%
/src/controller/product-category-controller.ts 8.77% 0% 0% 8.77%
/src/controller/product-controller.ts 9.6% 0% 0% 9.91%
/src/controller/rbac-controller.ts 4.82% 0% 0% 4.92%
/src/controller/root-controller.ts 20.68% 100% 0% 20.68%
/src/controller/seller-payout-controller.ts 5.3% 0% 0% 5.34%
/src/controller/server-settings-controller.ts 23.52% 100% 0% 23.52%
/src/controller/simple-file-controller.ts 11.62% 0% 0% 11.62%
/src/controller/stripe-controller.ts 22.22% 0% 0% 22.22%
/src/controller/stripe-webhook-controller.ts 12.19% 0% 0% 12.19%
/src/controller/test-controller.ts 33.33% 100% 0% 33.33%
/src/controller/transaction-controller.ts 9.9% 0% 0% 10.2%
/src/controller/transfer-controller.ts 12.28% 0% 0% 12.72%
/src/controller/user-controller.ts 5.72% 0% 0% 5.76%
/src/controller/vat-group-controller.ts 6.09% 0% 0% 6.09%
/src/controller/voucher-group-controller.ts 8.82% 0% 0% 8.82%
/src/controller/write-off-controller.ts 14.54% 0% 0% 14.54%
/src/controller/request/file-request.ts 0% 0% 0% 0%
/src/controller/request/validators/container-request-spec.ts 52.94% 0% 0% 64.28%
/src/controller/request/validators/general-validators.ts 36.53% 0% 0% 30.76%
/src/controller/request/validators/invoice-request-spec.ts 26% 0% 0% 32.5%
/src/controller/request/validators/point-of-sale-request-spec.ts 50% 0% 0% 58.82%
/src/controller/request/validators/product-request-spec.ts 48.38% 0% 14.28% 46.66%
/src/controller/request/validators/rbac-request-spec.ts 56.25% 0% 0% 60%
/src/controller/request/validators/string-spec.ts 53.33% 0% 25% 50%
/src/controller/request/validators/update-local-request-spec.ts 54.54% 0% 0% 66.66%
/src/controller/request/validators/update-nfc-request-spec.ts 42.85% 0% 0% 54.54%
/src/controller/request/validators/update-pin-request-spec.ts 50% 0% 0% 55.55%
/src/controller/request/validators/user-request-spec.ts 43.47% 0% 0% 55.55%
/src/controller/request/validators/validation-errors.ts 67.1% 100% 0% 100%
/src/controller/response/dinero.ts 0% 0% 0% 0%
/src/database/database.ts 96.55% 75% 33.33% 97.64%
/src/database/schema.ts 92% 50% 50% 95.83%
/src/entity/banner.ts 100% 100% 100% 100%
/src/entity/base-entity-without-id.ts 100% 100% 100% 100%
/src/entity/base-entity.ts 100% 100% 100% 100%
/src/entity/server-setting.ts 53.84% 0% 0% 55.55%
/src/entity/vat-group.ts 100% 100% 100% 100%
/src/entity/authenticator/authentication-method.ts 100% 100% 100% 100%
/src/entity/authenticator/ean-authenticator.ts 100% 100% 100% 100%
/src/entity/authenticator/hash-based-authentication-method.ts 100% 100% 100% 100%
/src/entity/authenticator/key-authenticator.ts 100% 100% 100% 100%
/src/entity/authenticator/ldap-authenticator.ts 100% 100% 100% 100%
/src/entity/authenticator/local-authenticator.ts 100% 100% 100% 100%
/src/entity/authenticator/member-authenticator.ts 100% 100% 100% 100%
/src/entity/authenticator/nfc-authenticator.ts 100% 100% 100% 100%
/src/entity/authenticator/pin-authenticator.ts 100% 100% 100% 100%
/src/entity/authenticator/reset-token.ts 100% 100% 100% 100%
/src/entity/container/container-revision.ts 95.23% 100% 83.33% 92.85%
/src/entity/container/container.ts 100% 100% 100% 100%
/src/entity/event/event-shift-answer.ts 100% 100% 100% 100%
/src/entity/event/event-shift.ts 100% 100% 100% 100%
/src/entity/event/event.ts 100% 100% 100% 100%
/src/entity/file/banner-image.ts 100% 100% 100% 100%
/src/entity/file/base-file.ts 100% 100% 100% 100%
/src/entity/file/invoice-pdf.ts 100% 100% 100% 100%
/src/entity/file/payout-request-pdf.ts 100% 100% 100% 100%
/src/entity/file/pdf-able.ts 27.77% 0% 22.22% 31.25%
/src/entity/file/pdf-file.ts 100% 100% 100% 100%
/src/entity/file/product-image.ts 100% 100% 100% 100%
/src/entity/file/seller-payout-pdf.ts 100% 100% 100% 100%
/src/entity/fine/fine.ts 100% 100% 100% 100%
/src/entity/fine/fineHandoutEvent.ts 100% 100% 100% 100%
/src/entity/fine/userFineGroup.ts 100% 100% 100% 100%
/src/entity/invoices/invoice-entry.ts 100% 100% 100% 100%
/src/entity/invoices/invoice-status.ts 100% 100% 100% 100%
/src/entity/invoices/invoice.ts 97.82% 100% 92.3% 97.22%
/src/entity/point-of-sale/point-of-sale-revision.ts 94.44% 100% 75% 92.3%
/src/entity/point-of-sale/point-of-sale.ts 100% 100% 100% 100%
/src/entity/point-of-sale/product-ordering.ts 100% 100% 100% 100%
/src/entity/product/product-category.ts 100% 100% 100% 100%
/src/entity/product/product-revision.ts 96.55% 100% 83.33% 95.45%
/src/entity/product/product.ts 100% 100% 100% 100%
/src/entity/rbac/assigned-role.ts 100% 100% 100% 100%
/src/entity/rbac/permission.ts 85.71% 100% 33.33% 81.81%
/src/entity/rbac/role-user-type.ts 100% 100% 100% 100%
/src/entity/rbac/role.ts 90.47% 100% 75% 91.66%
/src/entity/report/fine-report.ts 50% 100% 0% 50%
/src/entity/report/report.ts 100% 100% 100% 100%
/src/entity/stripe/stripe-deposit.ts 100% 100% 100% 100%
/src/entity/stripe/stripe-payment-intent-status.ts 100% 100% 100% 100%
/src/entity/stripe/stripe-payment-intent.ts 100% 100% 100% 100%
/src/entity/transactions/balance.ts 100% 100% 100% 100%
/src/entity/transactions/flagged-transaction.ts 100% 100% 100% 100%
/src/entity/transactions/sub-transaction-row.ts 100% 100% 100% 100%
/src/entity/transactions/sub-transaction.ts 100% 100% 100% 100%
/src/entity/transactions/transaction.ts 100% 100% 100% 100%
/src/entity/transactions/transfer.ts 100% 100% 100% 100%
/src/entity/transactions/write-off.ts 100% 100% 100% 100%
/src/entity/transactions/payout/base-payout.ts 91.66% 100% 66.66% 90%
/src/entity/transactions/payout/payout-request-status.ts 100% 100% 100% 100%
/src/entity/transactions/payout/payout-request.ts 100% 100% 100% 100%
/src/entity/transactions/payout/seller-payout.ts 100% 100% 100% 100%
/src/entity/transformer/dinero-transformer.ts 100% 100% 100% 100%
/src/entity/user/invoice-user.ts 100% 100% 100% 100%
/src/entity/user/local-user.ts 100% 100% 100% 100%
/src/entity/user/user-voucher-group.ts 100% 100% 100% 100%
/src/entity/user/user.ts 93.47% 75% 75% 94.87%
/src/entity/user/voucher-group.ts 100% 100% 100% 100%
/src/errors/index.ts 100% 100% 0% 100%
/src/errors/not-implemented-error.ts 20% 0% 0% 20%
/src/errors/pdf-error.ts 20% 0% 0% 20%
/src/files/initialize.ts 57.14% 0% 0% 57.14%
/src/files/response.ts 28.57% 100% 0% 28.57%
/src/files/storage/disk-storage.ts 17.85% 0% 10% 17.85%
/src/files/storage/file-storage.ts 100% 100% 100% 100%
/src/files/storage/index.ts 100% 100% 50% 100%
/src/files/storage/locations.ts 100% 100% 100% 100%
/src/gewis/gewis.ts 28.12% 0% 0% 31.03%
/src/gewis/controller/gewis-authentication-controller.ts 21.42% 0% 0% 21.42%
/src/gewis/database/seed.ts 18.18% 100% 0% 22.22%
/src/gewis/entity/gewis-user.ts 100% 100% 100% 100%
/src/gewis/helpers/gewis-helper.ts 9.09% 0% 0% 14.28%
/src/gewis/service/gewisdb-service.ts 27.39% 0% 0% 30.3%
/src/helpers/ad.ts 31.81% 100% 0% 31.81%
/src/helpers/bindings.ts 88.88% 100% 0% 88.88%
/src/helpers/database.ts 50% 100% 0% 60%
/src/helpers/express-pdf.ts 10% 0% 0% 10%
/src/helpers/hash.ts 50% 100% 0% 50%
/src/helpers/ordering.ts 54.54% 33.33% 50% 60%
/src/helpers/pagination.ts 26.47% 2.38% 25% 24.13%
/src/helpers/pdf.ts 41.37% 8.33% 0% 46.15%
/src/helpers/query-filter.ts 39.34% 33.33% 22.22% 47.05%
/src/helpers/raw-body.ts 50% 100% 0% 50%
/src/helpers/revision-to-response.ts 69.56% 40% 44.44% 71.42%
/src/helpers/specification-validation.ts 21.62% 0% 11.11% 25%
/src/helpers/timestamps.ts 58.82% 42.85% 66.66% 56.25%
/src/helpers/token-helper.ts 20% 0% 0% 33.33%
/src/helpers/transaction-mapper.ts 16.43% 0% 0% 17.64%
/src/helpers/validators.ts 30% 12.16% 15% 37.2%
/src/mailer/index.ts 100% 100% 0% 100%
/src/mailer/mail-body-generator.ts 20.83% 33.33% 0% 20.83%
/src/mailer/mail-message.ts 41.66% 50% 33.33% 45.45%
/src/mailer/mailer.ts 26.66% 0% 0% 26.66%
/src/mailer/transporter.ts 66.66% 0% 0% 66.66%
/src/mailer/messages/changed-pin.ts 85.71% 100% 0% 85.71%
/src/mailer/messages/forgot-event-planning.ts 46.15% 100% 0% 46.15%
/src/mailer/messages/hello-world.ts 54.54% 100% 0% 54.54%
/src/mailer/messages/index.ts 100% 100% 100% 100%
/src/mailer/messages/mail-content-builder.ts 18.18% 0% 50% 18.18%
/src/mailer/messages/membership-expiry-notification.ts 46.66% 0% 0% 46.66%
/src/mailer/messages/password-reset.ts 33.33% 0% 0% 33.33%
/src/mailer/messages/user-debt-notification.ts 42.85% 0% 0% 42.85%
/src/mailer/messages/user-got-fined.ts 46.15% 100% 0% 46.15%
/src/mailer/messages/user-will-get-fined.ts 33.33% 0% 0% 33.33%
/src/mailer/messages/welcome-to-sudosos.ts 42.85% 0% 0% 42.85%
/src/mailer/messages/welcome-with-reset.ts 42.85% 0% 0% 42.85%
/src/middleware/policy-middleware.ts 9.09% 0% 0% 9.09%
/src/middleware/request-validator-middleware.ts 7.69% 0% 0% 8.33%
/src/middleware/restriction-middleware.ts 15.38% 0% 0% 16%
/src/middleware/token-middleware.ts 10% 0% 0% 10%
/src/migrations/1707251162194-invoice-refactor.ts 5.71% 0% 0% 6.06%
/src/migrations/1720608140757-soft-deletes.ts 25% 100% 0% 25%
/src/migrations/1720610649657-payout-request-pdf.ts 12.5% 100% 0% 14.28%
/src/migrations/1720624912260-database-rbac.ts 13.72% 0% 4.76% 14.43%
/src/migrations/1721916495084-transfers-vat.ts 16.66% 0% 0% 18.18%
/src/migrations/1722004753128-write-offs.ts 23.8% 0% 0% 26.31%
/src/migrations/1722022351000-pos-cashiers.ts 33.33% 100% 0% 33.33%
/src/migrations/1722083254200-server-settings.ts 50% 100% 0% 50%
/src/migrations/1722084520361-pos-users.ts 21.05% 100% 0% 22.22%
/src/migrations/1722118077157-invoice-rework.ts 13.33% 0% 0% 14.28%
/src/migrations/1722517212441-nested-product-categories.ts 15.38% 100% 0% 16.66%
/src/migrations/1722869409448-stripe-payment-intents.ts 11.11% 100% 16.66% 12.12%
/src/migrations/1724506999318-invoice-as-topups.ts 11.39% 0% 0% 12.5%
/src/migrations/1724855153990-seller-payouts.ts 14.28% 0% 5.55% 16.03%
/src/migrations/1725196803203-user-type-enums.ts 15% 0% 0% 15%
/src/rbac/default-roles.ts 26.31% 0% 0% 31.25%
/src/rbac/role-manager.ts 20% 0% 8.33% 23.8%
/src/server-settings/server-settings-store.ts 8.77% 0% 7.14% 9.61%
/src/server-settings/setting-defaults.ts 100% 100% 100% 100%
/src/service/ad-service.ts 9.47% 0% 0% 12%
/src/service/authentication-service.ts 13.67% 2.85% 0% 14.41%
/src/service/balance-service.ts 92.98% 84.5% 92.3% 93.06%
/src/service/banner-service.ts 7.14% 0% 0% 7.31%
/src/service/container-service.ts 12.87% 2.56% 8% 15.47%
/src/service/debtor-service.ts 13.55% 0% 0% 15.38%
/src/service/event-service.ts 9.09% 0% 0% 11.03%
/src/service/file-service.ts 16.66% 20% 10% 16.9%
/src/service/invoice-service.ts 74.09% 56.25% 62% 79.33%
/src/service/payout-request-service.ts 10.86% 0% 0% 11.9%
/src/service/point-of-sale-service.ts 53.42% 26.92% 53.33% 53.73%
/src/service/product-category-service.ts 15.15% 0% 0% 16.12%
/src/service/product-service.ts 16.66% 6.66% 4.54% 19.23%
/src/service/rbac-service.ts 4.87% 0% 0% 6.06%
/src/service/report-service.ts 76.69% 33.33% 60% 85.86%
/src/service/seller-payout-service.ts 21.56% 0% 0% 22%
/src/service/stripe-service.ts 86.56% 80% 76.47% 87.3%
/src/service/transaction-service.ts 40.34% 15.59% 43.33% 41.78%
/src/service/transfer-service.ts 48.88% 33.33% 36.36% 50%
/src/service/user-service.ts 14.04% 0% 0% 15.74%
/src/service/vat-group-service.ts 15.78% 0% 0% 18.18%
/src/service/voucher-group-service.ts 11.76% 0% 0% 12.5%
/src/service/write-off-service.ts 27.45% 0% 0% 28.57%
/src/service/pdf/invoice-pdf-service.ts 21.87% 0% 14.28% 25.92%
/src/service/pdf/payout-request-pdf-service.ts 77.77% 100% 33.33% 77.77%
/src/service/pdf/pdf-service.ts 36.84% 66.66% 37.5% 36.84%
/src/service/pdf/report-pdf-service.ts 38.88% 0% 33.33% 38.88%
/src/service/pdf/seller-payout-pdf-service.ts 50% 100% 20% 57.14%
/src/service/pdf/user-report-pdf-service.ts 45% 0% 25% 50%
/src/start/swagger.ts 65% 35.29% 55.55% 66.66%
/src/subscriber/index.ts 100% 100% 100% 100%
/src/subscriber/transaction-subscriber.ts 41.17% 3.84% 66.66% 39.28%
/src/subscriber/transfer-subscriber.ts 90% 75% 100% 87.5%
JustSamuel commented 2 months ago

I tried a lot of combinations of different test suits, but this doesn't seem to actually make a difference? Any n test cases seem to cause it to hang, where n is around 2 or 3.

Using wtfnode gives me the impression that we are failing to close a typeorm session somewhere, which makes sense since it doesn't fail on sqlite (which has no connection pooling).

If it was a bad test case with a weird hanging promise, then sqlite should have had the same problem. More over, #266 also seems to have the same problem. Meaning that #263 is the last "good" one.

JustSamuel commented 2 months ago

Nvm, this seems to have been an issue since a looooongggg time. At least #225 but could have been longer. I suggest to just try and find the hanging mariadb connection instead of focusing on which test. Most likely it is not related to a test case but to our before and after of the test cases.