Skip to content

Revert "Prod deployment" #116

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

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ parameters:
type: boolean
defaults: &defaults
docker:
- image: cimg/python:3.11.0-browsers
- image: circleci/python:2.7-stretch-browsers
install_dependency: &install_dependency
name: Installation of build and deployment dependencies.
command: |
sudo apt update
sudo apt install jq python3-pip
# sudo pip install docker-compose
sudo pip3 install awscli --upgrade
sudo pip3 install docker-compose
# sudo pip install docker-compose
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
Expand All @@ -25,10 +23,10 @@ install_deploysuite: &install_deploysuite
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
restore_cache_settings_for_build: &restore_cache_settings_for_build
key: docker-node-modules-{{ checksum "yarn.lock" }}
key: docker-node-modules-{{ checksum "package-lock.json" }}

save_cache_settings: &save_cache_settings
key: docker-node-modules-{{ checksum "yarn.lock" }}
key: docker-node-modules-{{ checksum "package-lock.json" }}
paths:
- node_modules

Expand Down Expand Up @@ -97,13 +95,12 @@ jobs:
- run: *install_deploysuite
- run:
name: 'newman test'
no_output_timeout: 30m
command: |
./awsconfiguration.sh $DEPLOY_ENV
source awsenvconf
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-qa-appvar
source buildenvvar
npm install --loglevel verbose
npm i
cd mock
(npm run mock-challenge-api&)
(NODE_ENV=test npm start&)
Expand Down
3 changes: 1 addition & 2 deletions Verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,4 @@ Iteration 4/4

Then you can run `npm run test:newman:clear` to delete all testing data by above postman tests.
If 'socket hang up' appears while running the `npm run test:newman`. You can increase the `WAIT_TIME` from the `default/test.js`.
Then run `npm run test:newman:clear` before calling `npm run test:newman` again.

Then run `npm run test:newman:clear` before calling `npm run test:newman` again.
3 changes: 1 addition & 2 deletions app-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const UserRoles = {
}

const ChallengeStatuses = {
Completed: 'Completed',
Active: 'Active'
Completed: 'Completed'
}

module.exports = {
Expand Down
2 changes: 0 additions & 2 deletions config/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ module.exports = {
COPILOT_CREDENTIALS_PASSWORD: process.env.COPILOT_CREDENTIALS_PASSWORD || '',
USER_CREDENTIALS_USERNAME: process.env.USER_CREDENTIALS_USERNAME || '',
USER_CREDENTIALS_PASSWORD: process.env.USER_CREDENTIALS_PASSWORD || '',
MANAGER_CREDENTIALS_USERNAME: process.env.MANAGER_CREDENTIALS_USERNAME || '',
MANAGER_CREDENTIALS_PASSWORD: process.env.MANAGER_CREDENTIALS_PASSWORD || '',
AUTOMATED_TESTING_REPORTERS_FORMAT: process.env.AUTOMATED_TESTING_REPORTERS_FORMAT || ['cli', 'html']
}
4 changes: 0 additions & 4 deletions src/services/ResourceService.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,6 @@ async function init (currentUser, challengeId, resource, isCreated) {
throw new errors.BadRequestError('Cannot delete resources of a completed challenge!')
}

if (_.get(challenge, 'status') !== constants.ChallengeStatuses.Active && isCreated && resource.roleId === config.SUBMITTER_RESOURCE_ROLE_ID) {
throw new errors.BadRequestError(`Cannot create submitter resource on challenge with status ${_.get(challenge, 'status')}`)
}

// Prevent from creating more than 1 submitter resources on tasks
if (_.get(challenge, 'task.isTask', false) && isCreated && resource.roleId === config.SUBMITTER_RESOURCE_ROLE_ID) {
const existing = await getResources(currentUser, challengeId, config.SUBMITTER_RESOURCE_ROLE_ID, null, null, 1, 1)
Expand Down
22 changes: 10 additions & 12 deletions test/postman/newman.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,15 @@ async function clearTestData () {
/**
* Run the postman tests.
*/
clearTestData().then(() => {
apiTestLib.runTests(requests, require.resolve('./resource-api.postman_collection.json'),
require.resolve('./resource-api.postman_environment.json')).then(async () => {
logger.info('newman test completed!')
await clearTestData()
}).catch(async (err) => {
logger.logFullError(err)
apiTestLib.runTests(requests, require.resolve('./resource-api.postman_collection.json'),
require.resolve('./resource-api.postman_environment.json')).then(async () => {
logger.info('newman test completed!')
await clearTestData()
}).catch(async (err) => {
logger.logFullError(err)

// Only calling the clean up function when it is not validation error.
if (err.name !== 'ValidationError') {
await clearTestData()
}
})
// Only calling the clean up function when it is not validation error.
if (err.name !== 'ValidationError') {
await clearTestData()
}
})