Przeglądaj źródła

test: change test-db port to 5433 to be able to run it besides the main app

Nicolas Meienberger 2 lat temu
rodzic
commit
05c8dff8e2

+ 2 - 2
.github/workflows/ci.yml

@@ -16,7 +16,7 @@ jobs:
         env:
           POSTGRES_PASSWORD: postgres
         ports:
-          - 5432:5432
+          - 5433:5432
         # set health checks to wait until postgres has started
         options: >-
           --health-cmd pg_isready
@@ -32,7 +32,7 @@ jobs:
         with:
           node-version: 16
 
-      - uses: pnpm/action-setup@v2.0.1
+      - uses: pnpm/action-setup@v2.2.2
         name: Install pnpm
         id: pnpm-install
         with:

+ 1 - 0
.github/workflows/release.yml

@@ -7,6 +7,7 @@ on:
       
 jobs:
   release:
+    if: github.repository == 'meienberger/runtipi'
     runs-on: ubuntu-latest
     steps:
       - name: Checkout

+ 1 - 1
package.json

@@ -12,7 +12,7 @@
     "start:rc": "docker-compose -f docker-compose.rc.yml --env-file .env up --build",
     "start:prod": "docker-compose --env-file .env up --build",
     "build:common": "cd packages/common && npm run build",
-    "start:pg": "docker run --name test-db -p 5432:5432 -d --rm -e POSTGRES_PASSWORD=postgres postgres",
+    "start:pg": "docker run --name test-db -p 5433:5432 -d --rm -e POSTGRES_PASSWORD=postgres postgres",
     "version": "echo $npm_package_version"
   },
   "devDependencies": {

+ 1 - 1
packages/system-api/ormconfig.ts

@@ -3,7 +3,7 @@ import { DataSource } from 'typeorm';
 export const connectionSource = new DataSource({
   type: 'postgres',
   host: 'localhost',
-  port: 5432,
+  port: 5433,
   username: 'postgres',
   password: 'postgres',
   database: 'postgres',

+ 15 - 9
packages/system-api/src/test/connection.ts

@@ -4,12 +4,18 @@ import User from '../modules/auth/user.entity';
 import pg from 'pg';
 import Update from '../modules/system/update.entity';
 
+const HOST = 'localhost';
+const USER = 'postgres';
+const DATABASE = 'postgres';
+const PASSWORD = 'postgres';
+const PORT = 5433;
+
 const pgClient = new pg.Client({
-  user: 'postgres',
-  host: 'localhost',
-  database: 'postgres',
-  password: 'postgres',
-  port: 5432,
+  user: USER,
+  host: HOST,
+  database: DATABASE,
+  password: PASSWORD,
+  port: PORT,
 });
 
 export const setupConnection = async (testsuite: string): Promise<DataSource> => {
@@ -21,10 +27,10 @@ export const setupConnection = async (testsuite: string): Promise<DataSource> =>
   const AppDataSource = new DataSource({
     name: 'default',
     type: 'postgres',
-    host: 'localhost',
-    port: 5432,
-    username: 'postgres',
-    password: 'postgres',
+    host: HOST,
+    port: PORT,
+    username: USER,
+    password: PASSWORD,
     database: testsuite,
     dropSchema: true,
     logging: false,