Skip to content

Commit

Permalink
Include v4 api:mocha tests in dev setup
Browse files Browse the repository at this point in the history
  • Loading branch information
minottic committed Nov 12, 2024
1 parent e8be49c commit 1963d7b
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 1 deletion.
5 changes: 5 additions & 0 deletions services/backend/services/v4/compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ services:
volumes:
- v4_dev:/home/node/app
- ${PWD}/entrypoints/setup_git.sh:/docker-entrypoints/2.sh
- ./config/functionalAccounts.dev.json:/home/node/app/functionalAccounts.json
- ./entrypoints/tests.sh:/docker-entrypoints/3.sh
env_file:
- ./config/.dev.env
healthcheck:
start_period: 2m

volumes:
v4_dev:
Expand Down
11 changes: 11 additions & 0 deletions services/backend/services/v4/config/.dev.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
MONGODB_URI=mongodb://mongodb:27017/dev_be_next
ADMIN_GROUPS=admin,adminingestor
CREATE_DATASET_GROUPS=group1,group2,group3
CREATE_DATASET_WITH_PID_GROUPS=group2
CREATE_DATASET_PRIVILEGED_GROUPS=datasetIngestor,group3
SAMPLE_PRIVILEGED_GROUPS=sampleingestor
SAMPLE_GROUPS=group1
DATASET_CREATION_VALIDATION_ENABLED=true
DATASET_CREATION_VALIDATION_REGEX=^scicatlive_testing/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$
PID_PREFIX=scicatlive_testing
SITE=PSI
2 changes: 1 addition & 1 deletion services/backend/services/v4/config/.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ JWT_SECRET=secret
EXPRESS_SESSION_SECRET=secret

ADMIN_GROUPS=admin
DELETE_GROUPS=buggy
DELETE_GROUPS=archivemanager
CREATE_DATASET_GROUPS=ingestor
PROPOSAL_GROUPS=proposalingestor
SAMPLE_GROUPS=ingestor
86 changes: 86 additions & 0 deletions services/backend/services/v4/config/functionalAccounts.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[
{
"username": "admin",
"email": "admin@scicat.project",
"password": "27f5fd86ae68fe740eef42b8bbd1d7d5",
"role": "admin",
"global": true
},
{
"username": "adminIngestor",
"email": "adminingestor@scicat.project",
"password": "13f4242dc691a3ee3bb5ca2006edcdf7",
"role": "adminingestor",
"global": false
},
{
"username": "archiveManager",
"email": "archivemanager@scicat.project",
"password": "6d3b76392e6f41b087c11f8b77e3f9de",
"role": "archivemanager",
"global": false
},
{
"username": "datasetIngestor",
"email": "datasetingestor@scicat.project",
"password": "bc35db76848cf9fbb7f40b6661644e97",
"role": "datasetingestor",
"global": false
},
{
"username": "proposalIngestor",
"email": "proposalingestor@scicat.project",
"password": "7d8cd858fb9d0e4f5d91c34fd4016167",
"role": "proposalingestor",
"global": false
},
{
"username": "sampleIngestor",
"email": "sampleingestor@scicat.project",
"password": "e4876cb39c7dc4fe957d7c4f6a34cdd8",
"role": "sampleingestor",
"global": false
},
{
"username": "user1",
"email": "user1@your.site",
"password": "a609316768619f154ef58db4d847b75e",
"role": "group1",
"global": false
},
{
"username": "user2",
"email": "user2@your.site",
"password": "f522d1d715970073a6413474ca0e0f63",
"role": "group2",
"global": false
},
{
"username": "user3",
"email": "user3@your.site",
"password": "70dc489e8ee823ae815e18d664424df2",
"role": "group3",
"global": false
},
{
"username": "user4",
"email": "user4@your.site",
"password": "0014890e7020f515b92b767227ef2dfa",
"role": "group4",
"global": false
},
{
"username": "user5.1",
"email": "user5.1@your.site",
"password": "359a5fda99bfe5dbc42ee9b3ede77fb7",
"role": "group5",
"global": false
},
{
"username": "user5.2",
"email": "user5.2@your.site",
"password": "f3ebd2e4def95db59ef95ee32ef45242",
"role": "group5",
"global": false
}
]
7 changes: 7 additions & 0 deletions services/backend/services/v4/entrypoints/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
## Setting the --runInBand makes the tests run sequentially,
## avoiding to fill the RAM which makes them freeze
npm run test -- --runInBand

npm start &
PID="${!}"
sleep 15
npm run test:api:mocha

kill "${PID}"

0 comments on commit 1963d7b

Please sign in to comment.