Skip to content

Commit ef70fab

Browse files
committed
Update Dockerfile to use Crystal 1.18.2 and enhance run.sh for parallel testing support
1 parent c97ffca commit ef70fab

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM crystallang/crystal:1.15.1-alpine
1+
FROM crystallang/crystal:1.18.2-alpine
22

33
# install packages required to run the tests
44
RUN apk add --no-cache bash jq coreutils

bin/run.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ echo "${slug}: testing..."
4141

4242
# Run the tests for the provided implementation file and redirect stdout and
4343
# stderr to capture it
44+
45+
if [ "${slug}" = "parallel-letter-frequency" ]; then
46+
crystal spec "${modified_spec_file}" --junit_output="${output_dir}" --tag "~optional" -Dpreview_mt --no-color &> "${capture_file}"
47+
else
4448
crystal spec "${modified_spec_file}" --junit_output="${output_dir}" --tag "~optional" --no-color &> "${capture_file}"
49+
fi
4550

4651
./bin/test_runner "${spec_file}" "${capture_file}" "${junit_file}" "${results_file}"
4752

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 2.1.3
2+
3+
- Move to Crystal 1.19.x
4+
- Add support for parallel testing
5+
16
# 2.1.2
27

38
- Move to Crystal 1.15.1

helpers/setup_test_file.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ def fix_test_file(spec_input, spec_output)
33
spec_file = File.read(spec_input).split("\n")
44
index = spec_file.index {|x| x.includes?("describe")}
55
unless index.nil?
6-
spec_file = spec_file.insert(index + 1, "around_each do |example|\noriginal_stdout = File.open(\"/dev/null\")\noriginal_stdout.reopen(STDOUT)\nIO.pipe do |reader, writer|\nSTDOUT.reopen(writer)\nbegin\nexample.run\nensure\nwriter.close\nSTDOUT.reopen(original_stdout)\nend\nadd = File.exists?(\"/tmp/output.json\") ? JSON.parse(File.read(\"/tmp/output.json\")).to_s[1..-2] + \", \" : \"\"\nFile.write(\"/tmp/output.json\", JSON.parse(\"[\" + add + \"\#{reader.gets_to_end.split(\"\n\")[..-2].join(\"\n\").inspect}]\"))\nend\nend\n")
6+
spec_file = spec_file.insert(index + 1, "around_each do |example|\noriginal_stdout = File.open(\"/dev/null\")\noriginal_stdout.reopen(STDOUT)\nIO.pipe do |reader, writer|\nSTDOUT.reopen(writer)\nbegin\nexample.run\nensure\nwriter.close\nSTDOUT.reopen(original_stdout)\nend\nadd = File.exists?(\"/tmp/output.json\") ? File.read(\"/tmp/output.json\").to_s[1..-2] + \", \" : \"\"\nFile.write(\"/tmp/output.json\", \"[\" + add + \"\#{reader.gets_to_end.split(\"\n\")[..-2].join(\"\n\").inspect}]\")\nend\nend\n")
77
end
88
unless spec_output.nil?
99
File.write(spec_output, "require \"json\"\n" + spec_file.join("\n").gsub("pending", "it"))

0 commit comments

Comments
 (0)