Skip to content

Commit

Permalink
Include v4 api:mocha tests in dev setup (#358)
Browse files Browse the repository at this point in the history
* Include v4 api:mocha tests in dev setup

* Increase retries

* Reuse credentials
  • Loading branch information
minottic authored Nov 13, 2024
1 parent cc24a28 commit 425262a
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 1 deletion.
6 changes: 6 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,13 @@ 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:
retries: 20
interval: 1m

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
93 changes: 93 additions & 0 deletions services/backend/services/v4/config/functionalAccounts.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
[
{
"username": "admin",
"email": "scicatadmin@your.site",
"password": "2jf70TPNZsS",
"role": "admin",
"global": true
},
{
"username": "adminIngestor",
"email": "adminingestor@scicat.project",
"password": "13f4242dc691a3ee3bb5ca2006edcdf7",
"role": "adminingestor",
"global": false
},
{
"username": "ingestor",
"password": "aman",
"email": "scicatingestor@your.site",
"role": "ingestor",
"global": false
},
{
"username": "archiveManager",
"email": "scicatarchivemanager@your.site",
"password": "aman",
"role": "archivemanager",
"global": false
},
{
"username": "datasetIngestor",
"email": "datasetingestor@scicat.project",
"password": "bc35db76848cf9fbb7f40b6661644e97",
"role": "datasetingestor",
"global": false
},
{
"username": "proposalIngestor",
"email": "scicatproposalingestor@your.site",
"password": "aman",
"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 30
npm run test:api:mocha

kill "${PID}"

0 comments on commit 425262a

Please sign in to comment.