summaryrefslogtreecommitdiff
path: root/test/test.sh
blob: 53c1805ad30952beb5c8b2382a679e6c18426842 (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
#!/bin/bash

set -e

for project in ruby-bundler-rails java-maven; do
  # Clone the test repository.
  echo "Cloning the test repository https://gitlab.com/gitlab-org/security-products/tests/$project.git"
  git clone "https://gitlab.com/gitlab-org/security-products/tests/$project.git" "/code/$project"

  # Run license management on it.
  echo "Running license management on the $project"
  cd  "/code/$project"
  /run.sh analyze .

  # Compare results with expected results.
  set +e
  diff "/code/$project/gl-license-management-report.json" "/test/results/$project.json" > /diff.txt
  set -e

  if [ -s /diff.txt ] ; then
    echo "Unexpected result. Here is the diff between actual results and those expected :"
    cat /diff.txt
    exit 1
  fi
done

echo "All tests are OK."