-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_server.sh
56 lines (35 loc) · 1.52 KB
/
test_server.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
!/bin/bash
GIT_USER="krushnat90"
GIT_PAT="<GIT Public Access Token to clone repository>"
GIT_REPO="https://$GIT_USER:$GIT_PAT@gitlab.crio.do/COHORT_ME_BUILDOUT_XMEME_ENROLL_1612436694845/krushnat90-me_buildout_xmeme.git"
CODE_DIR="krushnat90-me_buildout_xmeme"
SERVER_URL="http://localhost:8081/memes"
# git clone the repo
git clone $GIT_REPO
# cd to the cloned repo directory
cd $CODE_DIR
# Run the user’s installation steps which will install any necessary dependencies required for the server to run, with sudo permission
chmod +x install.sh
sudo ./install.sh
# 1. Run the user’s server execution steps which will bring up the server
# 2. We’ll be running your server_run.sh as a background process (using &) so that we can run the next set of commands
chmod +x server_run.sh
./server_run.sh &
# 3. Add a sleep timer to sleep.sh depending upon how long you want to sleep so that the server is ready.
chmod +x sleep.sh
./sleep.sh
# Execute the GET /memes endpoint using curl to ensure your DB is in a clean slate
# Should return an empty array.
curl --location --request GET $SERVER_URL
# Execute the POST /memes endpoint using curl
curl --location --request POST $SERVER_URL \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "xyz",
"url": "abc.com",
"caption": "This is a meme"
}'
# Execute the GET /memes endpoint using curl
curl --location --request GET $SERVER_URL
# If you have swagger enabled, make sure it is exposed at localhost:8080
curl --location --request GET 'http://localhost:8081/swagger-ui/'