-
Notifications
You must be signed in to change notification settings - Fork 3.2k
test: improve database test setup #14982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖 |
| - name: Cache Docker images | ||
| uses: ScribeMD/docker-cache@0.5.0 | ||
| # Use AndreKurait/docker-cache@0.6.0 instead of ScribeMD/docker-cache@0.5.0 to fix the following issue: https://github.com/ScribeMD/docker-cache/issues/837 ("Warning: Failed to restore: Cache service responded with 400") | ||
| uses: AndreKurait/docker-cache@0.6.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The caching was completely broken before.
I'm not adding it to the start-database action, as it seems to break health checks. Need to investigate further, but not in this PR
| @@ -1,6 +1,5 @@ | |||
| # Sample creds for working locally with docker-compose | |||
|
|
|||
| MONGODB_URI=mongodb://localhost/payload-plugin-cloud-storage | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know why we had this - this won't work anymore. It should use the default URL or whatever env variable the CI action sets
| await runInit(testSuiteArg, true) | ||
|
|
||
| if (shouldStartMemoryDB) { | ||
| await startMemoryDB() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
goodbye!
| testMatch: ['<rootDir>/**/*int.spec.ts'], | ||
| setupFilesAfterEnv: ['<rootDir>/jest.setup.js'], | ||
|
|
||
| globalSetup: path.resolve(dirname, './helpers/startMemoryDB.ts'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vitest equivalent of this is what breaks debugging. Breakpoints are simply ignored.
| Payload is structured as a Monorepo, encompassing not only the core Payload platform but also various plugins and packages. To install all required dependencies, you have to run `pnpm install` once in the root directory. **PNPM IS REQUIRED!** Yarn or npm will not work - you will have to use pnpm to develop in the core repository. In most systems, the easiest way to install pnpm is to run `corepack enable` in your terminal. | ||
| Payload is structured as a Monorepo, encompassing not only the core Payload platform but also various plugins and packages. To install all required dependencies, you have to run `pnpm install` once in the root directory. **PNPM IS REQUIRED!** Yarn or npm will not work - you will have to use pnpm to develop in the core repository. In most systems, the easiest way to install pnpm is to run `npm add -g pnpm` in your terminal. | ||
|
|
||
| If you're coming from a very outdated version of payload, it is recommended to nuke the node_modules folder before running pnpm install. On UNIX systems, you can easily do that using the `pnpm clean:unix` command, which will delete all node_modules folders and build artefacts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clean:unix script does not exist anymore and has been replaced with a cross-platform reinstall script long ago.
| If you're coming from a very outdated version of payload, it is recommended to nuke the node_modules folder before running pnpm install. On UNIX systems, you can easily do that using the `pnpm clean:unix` command, which will delete all node_modules folders and build artefacts. | ||
| If you're coming from a very outdated version of payload, it is recommended to perform a clean install, which nukes the node_modules folder and reinstalls all dependencies. You can easily do that using the `pnpm reinstall` command. | ||
|
|
||
| It is also recommended to use at least Node v18 or higher. You can check your current node version by typing `node --version` in your terminal. The easiest way to switch between different node versions is to use [nvm](https://github.com/nvm-sh/nvm#intro). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
23.11.0 is what we have defined in our .node-version file
| 4. Add a `DOCS_DIR` environment variable to the `.env` file which points to the absolute path of your modified docs folder. For example `DOCS_DIR=/Users/yourname/Documents/GitHub/payload/docs` | ||
| 5. Run `pnpm fetchDocs:local`. If this was successful, you should see no error messages and the following output: _Docs successfully written to /.../website/src/app/docs.json_. There could be error messages if you have incorrect markdown in your local docs folder. In this case, it will tell you how you can fix it | ||
| 6. You're done! Now you can start the website locally using `pnpm dev` and preview the docs under [http://localhost:3000/docs/local](http://localhost:3000/docs/local) | ||
| 3. Follow the instructions in the [README of the website repository](https://github.com/payloadcms/website/blob/main/README.md#documentation) to preview the docs locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs here were outdated. No need to maintain this documentation in two places, just read the website readme which is kept up-to-date
denolfe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very well done, glad we're finally making this change. Thank you for the narration comments on the PR as well, very helpful.
|
🚀 This is included in version v3.69.0 |
This PR brings over most of the test suite improvements I made here to our payload monorepo.
vitest#14337). Currently, debugging does not work in that PR - this is due to the global setup script that has to start the mongo memory db.mongot, which unlocks support for vector search. This means we could add vector storage/search tests similar to the ones we have for postgres.github/actions/start-database/action.yml. Locally, everything is scoped totest/helpers/db. Each database adapter now shares the same username, password and db name