blob: 4b1fc6ae19161cb41aa243d4acaf942c96176ad7 (
plain)
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
|
#!/bin/bash
COMMIT_REF=${1:-$CI_COMMIT_REF_SLUG}
RSPEC_ARGS=$2
if [ -z "${COMMIT_REF}" ]; then
echo "Please provide a commit ref with the code to be tested as the first argument"
exit 1
fi
# Set the GitLab license mode to "test" so that GitLab uses the appropriate encryption key
export GITLAB_LICENSE_MODE="test"
# Create the temporary directory that screenshots are saved to
sudo install -m 777 -d /home/gdk/gdk/gitlab/qa/tmp
# Update GDK
(cd .. ; gdk update ; cat gdk.yml)
# Reset, fetch, and checkout the GitLab repository with the code from the ref to be tested
git reset --hard
git fetch origin $COMMIT_REF
git checkout $COMMIT_REF
# Install the required gems
bundle install --jobs=$(nproc) --retry=3 --quiet
# Run the database migrations
bundle exec rake db:migrate
# Restart GDK to be sure any changes are accounted for in running services, start any stopped services, and wait until the GDK is reachable
(cd .. ; gdk restart ; ./support/test_url http://gdk.test:3000)
# Install the required gems in the QA directory
cd qa
bundle install --jobs=$(nproc) --retry=3 --quiet
# Run the tests
bundle exec rake "knapsack:download[test]"
bundle exec bin/qa Test::Instance::All http://gdk.test:3000 -- $RSPEC_ARGS || true
|