Skip to content

Upgrade to test runner v3 #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ target

results.json
!/bin/

.idea
17 changes: 2 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# === Build builder image ===

FROM gradle:7.3-jdk17 AS build
FROM gradle:8.2-jdk17 AS build

WORKDIR /home/builder

Expand All @@ -13,26 +13,13 @@ RUN gradle -i clean build
RUN gradle -i shadowJar \
&& cp build/libs/autotest-runner.jar .

FROM maven:3.8-eclipse-temurin-17 AS cache

# Ensure exercise dependencies are downloaded
WORKDIR /opt/exercise
COPY exercise .
RUN mvn test dependency:go-offline -DexcludeReactor=false

# === Build runtime image ===

FROM maven:3.8.6-eclipse-temurin-17-focal
FROM eclipse-temurin:17-focal
WORKDIR /opt/test-runner

# Copy binary and launcher script
COPY bin/ ./bin/
COPY --from=build /home/builder/autotest-runner.jar ./

# Copy cached dependencies
COPY --from=cache /root/.m2 /root/.m2

# Copy Maven pom.xml
COPY --from=cache /opt/exercise/pom.xml /root/pom.xml

ENTRYPOINT ["sh", "/opt/test-runner/bin/run.sh"]
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ To run the tests to verify the behavior of the test runner, do the following:
1. Open a terminal in the project's root
2. Run `./bin/run-tests.sh`

These are [golden tests][golden] that compare the `results.json` generated by running the current state of the code against the "known good" `tests/<test-name>/results.json`. All files created during the test run itself are discarded.
These are [golden tests][golden] that compare the `results.json` generated by running the current state of the code
against the "known good" `tests/<test-name>/expected_results.json`.
All files created during the test run itself are discarded.

When you've made modifications to the code that will result in a new "golden" state, you'll need to generate and commit a new `tests/<test-name>/results.json` file.
When you've made modifications to the code that will result in a new "golden" state,
you'll need to generate and commit a new `tests/<test-name>/expected_results.json` file.

## Run the tests using Docker

Expand All @@ -44,9 +47,12 @@ To run the tests to verify the behavior of the test runner using the Docker imag
1. Open a terminal in the project's root
2. Run `./bin/run-tests-in-docker.sh`

These are [golden tests][golden] that compare the `results.json` generated by running the current state of the code against the "known good" `tests/<test-name>/results.json`. All files created during the test run itself are discarded.
These are [golden tests][golden] that compare the `results.json` generated by running the current state of the code
against the "known good" `tests/<test-name>/expected_results.json`.
All files created during the test run itself are discarded.

When you've made modifications to the code that will result in a new "golden" state, you'll need to generate and commit a new `tests/<test-name>/results.json` file.
When you've made modifications to the code that will result in a new "golden" state,
you'll need to generate and commit a new `tests/<test-name>/expected_results.json` file.

[test-runners]: https://github.com/exercism/docs/tree/main/building/tooling/test-runners
[golden]: https://ro-che.info/articles/2017-12-04-golden-tests
Expand Down
7 changes: 2 additions & 5 deletions bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ mkdir -p $tmp_folder
cd $tmp_folder
cp -R $input_folder/* .

find . -mindepth 1 -type f | grep 'Test.java' | xargs -I file sed -i "s/@Ignore(.*)//g;s/@Ignore//g;" file
find . -mindepth 1 -type f | grep 'Test.java' | xargs -I file sed -i "s/@Ignore(.*)//g;s/@Ignore//g;s/@Disabled(.*)//g;s/@Disabled//g;" file

cp /root/pom.xml .

java -jar /opt/test-runner/autotest-runner.jar $problem_slug
mv results.json $output_folder
java -jar /opt/test-runner/autotest-runner.jar $problem_slug . $output_folder
24 changes: 0 additions & 24 deletions exercise/build.gradle

This file was deleted.

102 changes: 0 additions & 102 deletions exercise/pom.xml

This file was deleted.

43 changes: 0 additions & 43 deletions exercise/src/main/java/Anagram.java

This file was deleted.

Loading