Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Aug 10, 2023
1 parent dce72dc commit a486c17
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ RUN gem install bundler -v 2.1.4

WORKDIR /opt/representer

COPY Gemfile Gemfile.lock .
COPY . .

RUN bundle install

COPY . .

ENTRYPOINT ["sh", "/opt/representer/bin/run.sh"]
35 changes: 15 additions & 20 deletions bin/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
#!/usr/bin/env sh

# Synopsis:
# Test the test runner by running it against a predefined set of solutions
# Test the representer by running it against a predefined set of solutions
# with an expected output.

# Output:
# Outputs the diff of the expected test results against the actual test results
# generated by the test runner.
# Outputs the diff of the expected representation files against the
# actual representation files generated by the test runner.

# Example:
# ./bin/run-tests.sh

exit_code=0
filenames="representation.txt mapping.json"

# Iterate over all test directories
for test_dir in tests/*/*; do
test_dir_name=$(basename "${test_dir}")
test_dir_path=$(realpath "${test_dir}")
results_file_path="${test_dir_path}/results.json"
expected_results_file_path="${test_dir_path}/expected_results.json"

bin/run.sh "${test_dir_name}" "${test_dir_path}" "${test_dir_path}"

# OPTIONAL: Normalize the results file
# If the results.json file contains information that changes between
# different test runs (e.g. timing information or paths), you should normalize
# the results file to allow the diff comparison below to work as expected
# sed -i -E \
# -e 's/Elapsed time: [0-9]+\.[0-9]+ seconds//g' \
# -e "s~${test_dir_path}~/solution~g" \
# "${results_file_path}"

echo "${test_dir_name}: comparing results.json to expected_results.json"
diff "${results_file_path}" "${expected_results_file_path}"

if [ $? -ne 0 ]; then
exit_code=1
fi
for filename in $filenames; do
actual_filepath="${test_dir_path}/${filename}"
expected_filepath="${test_dir_path}/expected_${filename}"

echo "${test_dir_name}: comparing ${filename} to expected_${filename}"
diff "${actual_filepath}" "${expected_filepath}"

if [ $? -ne 0 ]; then
exit_code=1
fi
done
done

exit ${exit_code}

0 comments on commit a486c17

Please sign in to comment.