This repository was archived by the owner on Nov 15, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +50
-4
lines changed Expand file tree Collapse file tree 4 files changed +50
-4
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,6 @@ disabled.
7
7
8
8
## Development Setup with docker-compose
9
9
10
- ## Development Setup
11
-
12
10
### Prerequisites
13
11
14
12
1 . Mac or Linux computer using zsh or bash.
@@ -52,7 +50,7 @@ api-server locally via your IDE or command line.
52
50
behavior is to initialize the database and disable outbound
53
51
email queueing.
54
52
```
55
- ./start-api-server.sh [-init-db-only | -no-db | -enable-mailout ]
53
+ ./start-api-server.sh [-init-db-only | -no-db | -enable-mailout | -mock-mode ]
56
54
```
57
55
58
56
### Method 2 - launch from IDE
@@ -72,3 +70,24 @@ Develop to your heart's content!!!! We _love_ pull-requests.
72
70
## Run everything in docker
73
71
74
72
Not working right now :(. Check back later.
73
+
74
+ ## Running Tests
75
+
76
+ As usual, make sure you are authenticated with vault.
77
+
78
+ Start the api server - use ` -mock-mode ` flag if needed
79
+ ``` bash
80
+ ./start-api-server.sh [-init-db-only | -n o-db | -e nable-mailout | -mock-mode ]
81
+ ```
82
+
83
+ In a separate terminal, source testMode.sh (this will also set CS_API_MOCK_MODE=1)
84
+
85
+ ``` bash
86
+ . ./testMode.sh
87
+ ```
88
+
89
+ then run the tests
90
+ ``` bash
91
+ cd api_server
92
+ npm run test
93
+ ```
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const { readVaultDevSecrets } = require('../../shared/server_utils/dev_secrets')
6
6
async function main ( ) {
7
7
const env = await readVaultDevSecrets ( ) ;
8
8
for ( const key in env ) {
9
- console . log ( `export ${ key } =" ${ shellescape ( [ env [ key ] ] ) } " ` ) ;
9
+ console . log ( `export ${ key } =${ shellescape ( [ env [ key ] ] ) } ` ) ;
10
10
}
11
11
}
12
12
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ CSSVC_ENV=$CSSVC_ENV
31
31
AWS access will use codestream-server/base/ keys from vault
32
32
"
33
33
34
+ echo " $* " | grep -q ' \-mock-mode' && {
35
+ echo " ======= Mocky ======="
36
+ export CS_API_MOCK_MODE=1
37
+ }
38
+
34
39
echo " $* " | grep -q ' \-no-db' || {
35
40
echo " ======= Initializing database ======="
36
41
init_database
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ function dev_settings {
4
+ for configVar in ` cat $SCRIPT_DIR /api_server/config/local.json| grep ' "' | cut -f2 -d\" ` ; do
5
+ value=$( grep " \" $configVar \" :" $SCRIPT_DIR /api_server/config/local.json| grep ' "' | cut -f4 -d\" )
6
+ echo " export $configVar ='$value '"
7
+ done
8
+ }
9
+
10
+ function dev_secrets {
11
+ $SCRIPT_DIR /api_server/bin/cs_dev_secrets.js
12
+ }
13
+
14
+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
15
+ export CSSVC_BACKEND_ROOT=$SCRIPT_DIR
16
+ export NODE_PATH=" $CSSVC_BACKEND_ROOT /api_server/node_modules:$CSSVC_BACKEND_ROOT /broadcaster/node_modules"
17
+ eval ` dev_settings` # Needed for dev_secrets to work
18
+ # dev_settings
19
+ eval ` dev_secrets`
20
+ export CS_API_MOCK_MODE=' 1'
21
+ export CSSVC_ENV=local
22
+ export CSSVC_CFG_FILE=" $CSSVC_BACKEND_ROOT /codestream-docker.json"
You can’t perform that action at this time.
0 commit comments