diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index ac46962fa..0ce22ab8c 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -29,13 +29,9 @@ jobs: run: npm ci - name: Setup local dynamo run: npm run tools-setup - - name: Build - run: npm run build - - name: unit tests - run: npm run test - - name: start + - name: Build and test timeout-minutes: 20 - run: npm run test-i + run: npm run prepush env: AWS_ACCESS_KEY_ID: foo AWS_SECRET_ACCESS_KEY: bar diff --git a/package.json b/package.json index 48736be04..222c52881 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ "audit": "npm audit --prod", "package": "mkdir ${ZIP_NAME} && cp package.json package-lock.json ${ZIP_NAME}/ && cp -r .build/src/* ${ZIP_NAME}/ && cd ${ZIP_NAME} && npm ci --production --ignore-scripts && rm package.json package-lock.json && zip -qr ../${ZIP_NAME}.zip .", "prepare": "husky install", - "tools-setup": "sls dynamodb install", - "pre-push": "npm run prepush" + "tools-setup": "sls dynamodb install" }, "repository": { "type": "git", diff --git a/scripts/getDBPid.sh b/scripts/getDBPid.sh index 9059e61ee..b2efdef64 100755 --- a/scripts/getDBPid.sh +++ b/scripts/getDBPid.sh @@ -1,3 +1,3 @@ !/bin/sh -lsof -i:8014 | awk '{print $2}' | tail -1 +lsof -i:8004 | awk '{print $2}' | tail -1 diff --git a/scripts/setup.ts b/scripts/setup.ts index 286db9fbe..350cdca2a 100644 --- a/scripts/setup.ts +++ b/scripts/setup.ts @@ -11,23 +11,18 @@ const setupServer = (process: any) => new Promise((resolve, reject) => { process.stdout.setEncoding('utf-8').on('data', (stream: any) => { console.log(`stdout: ${stream}`); if (stream.includes(SERVER_OK)) { - console.log('server ok') resolve(process); } - console.log('stdout doing nothing') }); process.stderr.setEncoding('utf-8').on('data', (stream: any) => { console.log(`stderr: ${stream}`); if (stream.includes(DYNAMO_LOCAL_ERROR_THREAD)) { - console.log('error') throw new Error('Internal Java process crashed'); } else if (stream.includes(SERVER_OK)) { - console.log('stderr server ok') resolve(process); } - console.log('stderr I\'m doing nothing') }); process.on('exit', (code: any, signal: any) => { @@ -37,13 +32,13 @@ const setupServer = (process: any) => new Promise((resolve, reject) => { }); }); -const server = exec('npm run start &', (error, stdout, stderr) => { +const server = exec('npm run start', (error, stdout, stderr) => { if (error) { - console.error(`exec error: ${error}`); + console.error(`error starting server: ${error}`); return; } - console.log(`stdout: ${stdout}`); - console.error(`stderr: ${stderr}`); + console.log(`stdout server: ${stdout}`); + console.error(`stderr server: ${stderr}`); }); module.exports = async () => { diff --git a/serverless.yml b/serverless.yml index 2ac8ce587..964f23f9f 100644 --- a/serverless.yml +++ b/serverless.yml @@ -30,13 +30,12 @@ custom: httpPort: 3006 serverless-dynamodb: start: - port: 8014 + port: 8004 inMemory: true migrate: true seed: true noStart: false host: 127.0.0.1 - docker: false seed: test-results: sources: diff --git a/src/config/config.yml b/src/config/config.yml index 43e5826c1..a757ac8a3 100644 --- a/src/config/config.yml +++ b/src/config/config.yml @@ -23,7 +23,7 @@ dynamodb: local: params: region: eu-west-1 - endpoint: http://127.0.0.1:8014 + endpoint: http://127.0.0.1:8004 convertEmptyValues: true table: cvs-local-test-results local-global: diff --git a/src/models/TestResultsDAO.ts b/src/models/TestResultsDAO.ts index 6fe4f1da8..a55ff49f0 100644 --- a/src/models/TestResultsDAO.ts +++ b/src/models/TestResultsDAO.ts @@ -28,7 +28,6 @@ export class TestResultsDAO { this.tableName = config.table; if (!TestResultsDAO.docClient) { - console.log('config for DynamoDB Client: ', config.params); TestResultsDAO.docClient = new AWS.DynamoDB.DocumentClient(config.params); } if (!TestResultsDAO.lambdaInvokeEndpoints) {