Skip to content

Feat: setup testing infrastructure#114

Merged
dahlia merged 6 commits into
fedify-dev:mainfrom
ThisIsMissEm:feat/bootstrap-for-testing
Feb 22, 2025
Merged

Feat: setup testing infrastructure#114
dahlia merged 6 commits into
fedify-dev:mainfrom
ThisIsMissEm:feat/bootstrap-for-testing

Conversation

@ThisIsMissEm

@ThisIsMissEm ThisIsMissEm commented Feb 21, 2025

Copy link
Copy Markdown
Contributor

This changes src/index.tsx to not directly start the application, but instead to just create it, such that it can be required in different scenarios.

The entrypoint bin/server.ts is now used instead, and I've also added support for specifying the LISTEN_HOST (this may currently be backwards incompatible, as Hollo may have been listening on all interfaces originally).

There is an issue here in that we can't currently migrate the "test" database because drizzle-kit doesn't seem to accept any way to pass the correct env-file to use, the documentation seems to suggest using dotenv instead: https://orm.drizzle.team/docs/get-started/postgresql-new

We also currently use the Flydrive-js Disk interface, but for testing we'd want to switch to DriveManager which supports fakes: https://flydrive.dev/docs/drive_manager (this means we don't actually need to test against s3 or fs disks), for now, I'm using the fs driver and creating a directory before running the tests. Issue #115 addresses this.

@ThisIsMissEm ThisIsMissEm force-pushed the feat/bootstrap-for-testing branch from 175935c to 7bd9fda Compare February 21, 2025 19:25
Comment thread package.json
"dev": "pnpm run migrate && tsx watch --env-file-if-exists=.env --dns-result-order=ipv6first bin/server.ts",
"test": "tsx --env-file-if-exists=.env.test --test",
"check": "tsc && biome check .",
"migrate": "drizzle-kit migrate",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We probably need to use dotenv in drizzle config in order to support migrating the test database in development, in CI the need for dotenv is bypassed because we're setting the DATABASE_URL as an environment variable.

@ThisIsMissEm

Copy link
Copy Markdown
Contributor Author

@dahlia as test / check does what check used to do from build / check you'll want to adjust the branch restrictions (though I have made it correctly use biome ci with the github reporter.

@ThisIsMissEm ThisIsMissEm force-pushed the feat/bootstrap-for-testing branch from ae77cc9 to 4de5638 Compare February 21, 2025 20:23
@ThisIsMissEm ThisIsMissEm changed the title Feat: bootstrap for testing Feat: setup testing infrastructure Feb 21, 2025
@@ -0,0 +1,165 @@
name: release

on:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This workflow is identical to the build.yaml workflow that's been removed, the only change is that we're not running this on pull requests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can probably delete the conditionals here on if it's a push.

@dahlia dahlia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot! I left a few review comments.

Comment thread .github/workflows/test.yaml Outdated
Comment thread .github/workflows/release.yaml
Comment thread .github/workflows/test.yaml Outdated
- "*.*.*"

jobs:
check:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@dahlia I'm not sure we even need check in this workflow, apart from the last step about something for tags and changes to be released?

@dahlia dahlia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Everything looks good to me. Thank you!

@dahlia dahlia merged commit 3ae52dc into fedify-dev:main Feb 22, 2025
dahlia added a commit that referenced this pull request Feb 22, 2025
@ThisIsMissEm ThisIsMissEm deleted the feat/bootstrap-for-testing branch February 24, 2025 02:27
@ThisIsMissEm ThisIsMissEm mentioned this pull request May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants