-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunTests.sh
executable file
·36 lines (26 loc) · 929 Bytes
/
runTests.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
#!/bin/bash
PSQL_SERVICE=postgresql
COMPOSE_FILE=docker-compose.yml
DATABASE_NAME=test
CONFIG_FILE=config.test.yml
# TODO change this to not be fragile as it relies on having an internet connection.
KB_HOST=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2)
# Install our project and output any errors
echo -n 'Building project...'
go install -v
echo 'finished'
# Create the tables in our database
echo 'Creating tables in DB...'
cat data/clearTables.sql data/init.sql data/testSetup.sql | PGPASSWORD=password psql -U kbase -d ${DATABASE_NAME} -h ${KB_HOST} -f - > /dev/null 2>&1
# Run our server
echo 'Running knowledge-base server'
knowledge-base -config=${CONFIG_FILE} > test_logs.txt 2>&1 &
PROJ_PID=$!
sleep 1
# Run our api-check tests
echo 'Running api-check tests...'
api-check run # github.com/JonathonGore/api-check
# Run our unit tests
echo 'Running go unit tests...'
go test ./...
kill $PROJ_PID