Skip to content

Commit

Permalink
chore(test): allow not mocking ticketing system for specific users in…
Browse files Browse the repository at this point in the history
… non-production environment
  • Loading branch information
sneko committed Jan 2, 2025
1 parent fba2638 commit a1fb2dd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.model
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ MAILER_FALLBACK_SMTP_HOST=
MAILER_FALLBACK_SMTP_PORT=
MAILER_FALLBACK_SMTP_USER=
MAILER_FALLBACK_SMTP_PASSWORD=
DISABLE_TICKETING_SYSTEM_MOCK_FOR_USER_IDS=
SENTRY_IGNORE_API_RESOLUTION_ERROR=1
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ MAILER_FALLBACK_SMTP_HOST=127.0.0.1
MAILER_FALLBACK_SMTP_PORT=11025
MAILER_FALLBACK_SMTP_USER=random
MAILER_FALLBACK_SMTP_PASSWORD=random
DISABLE_TICKETING_SYSTEM_MOCK_FOR_USER_IDS=00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000003
SENTRY_IGNORE_API_RESOLUTION_ERROR=1
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ For each build and runtime (since they are shared), you should have set some env
- `MAILER_FALLBACK_SMTP_PORT`: [SECRET]
- `MAILER_FALLBACK_SMTP_USER`: [SECRET]
- `MAILER_FALLBACK_SMTP_PASSWORD`: [SECRET]
- `DISABLE_TICKETING_SYSTEM_MOCK_FOR_USER_IDS`: [TO_DEFINE] _(environments that are not production will by default mock remote ticketing system calls. For testing purpose you can provide a comma separated UUID list of users who need to perform real tests)_

#### Review apps

Expand Down
6 changes: 5 additions & 1 deletion src/server/routers/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ export const eventRouter = router({
ticketingSystems.map(async (ticketingSystem) => {
let ticketingSystemClient: TicketingSystemClient;

if (process.env.APP_MODE !== 'prod') {
if (
process.env.APP_MODE !== 'prod' &&
(!process.env.DISABLE_TICKETING_SYSTEM_MOCK_FOR_USER_IDS ||
!process.env.DISABLE_TICKETING_SYSTEM_MOCK_FOR_USER_IDS.split(',').includes(ctx.user.id))
) {
ticketingSystemClient = new MockTicketingSystemClient();
} else {
switch (ticketingSystem.name) {
Expand Down

0 comments on commit a1fb2dd

Please sign in to comment.