Skip to content

Commit

Permalink
fix(cb2-11221): reverting extra changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shivangidas committed Mar 19, 2024
1 parent 66be659 commit d757ccc
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 22 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scripts/getDBPid.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
!/bin/sh

lsof -i:8014 | awk '{print $2}' | tail -1
lsof -i:8004 | awk '{print $2}' | tail -1
13 changes: 4 additions & 9 deletions scripts/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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 () => {
Expand Down
3 changes: 1 addition & 2 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion src/models/TestResultsDAO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d757ccc

Please sign in to comment.