Skip to content

Commit

Permalink
Tools: Run Joplin Server Postgres tests on CI (laurent22#5807)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Nov 30, 2021
1 parent 6eec0dd commit 6bbf053
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 22 deletions.
9 changes: 9 additions & 0 deletions .github/scripts/run_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ npm install
if [ "$IS_PULL_REQUEST" == "1" ] || [ "$IS_DEV_BRANCH" = "1" ]; then
echo "Step: Running tests..."

# On Linux, we run the Joplin Server tests using PostgreSQL
if [ "$IS_LINUX" == "1" ]; then
echo "Running Joplin Server tests using PostgreSQL..."
sudo docker-compose --file docker-compose.db-dev.yml up -d
export JOPLIN_TESTS_SERVER_DB=pg
else
echo "Running Joplin Server tests using SQLite..."
fi

# Need this because we're getting this error:
#
# @joplin/lib: FATAL ERROR: Ineffective mark-compacts near heap limit
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/github-actions-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
brew install translate-toolkit
- name: Install Docker Engine
if: runner.os == 'Linux' && startsWith(github.ref, 'refs/tags/server-v')
# if: runner.os == 'Linux' && startsWith(github.ref, 'refs/tags/server-v')
if: runner.os == 'Linux'
run: |
sudo apt-get install -y apt-transport-https
sudo apt-get install -y ca-certificates
Expand Down
5 changes: 0 additions & 5 deletions packages/lib/models/Folder.sharing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,6 @@ describe('models/Folder.sharing', function() {
note3 = await Note.load(note3.id);
note4 = await Note.load(note4.id);

console.info(note1.body);
console.info(note2.body);
console.info(note3.body);
console.info(note4.body);

expect(note1.body).not.toBe(note2.body);
expect(note1.body).not.toBe(note3.body);
expect(note1.body).not.toBe(note4.body);
Expand Down
34 changes: 18 additions & 16 deletions packages/server/src/utils/testing/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,24 @@ export async function beforeAllDb(unitName: string, createDbOptions: CreateDbOpt
//
// sudo docker compose -f docker-compose.db-dev.yml up

// await initConfig(Env.Dev, parseEnv({
// DB_CLIENT: 'pg',
// POSTGRES_DATABASE: unitName,
// POSTGRES_USER: 'joplin',
// POSTGRES_PASSWORD: 'joplin',
// SUPPORT_EMAIL: 'testing@localhost',
// }), {
// tempDir: tempDir,
// });

await initConfig(Env.Dev, parseEnv({
SQLITE_DATABASE: createdDbPath_,
SUPPORT_EMAIL: 'testing@localhost',
}), {
tempDir: tempDir,
});
if (process.env.JOPLIN_TESTS_SERVER_DB === 'pg') {
await initConfig(Env.Dev, parseEnv({
DB_CLIENT: 'pg',
POSTGRES_DATABASE: unitName,
POSTGRES_USER: 'joplin',
POSTGRES_PASSWORD: 'joplin',
SUPPORT_EMAIL: 'testing@localhost',
}), {
tempDir: tempDir,
});
} else {
await initConfig(Env.Dev, parseEnv({
SQLITE_DATABASE: createdDbPath_,
SUPPORT_EMAIL: 'testing@localhost',
}), {
tempDir: tempDir,
});
}

initGlobalLogger();

Expand Down

0 comments on commit 6bbf053

Please sign in to comment.