Skip to content

Commit 1efe8b9

Browse files
committed
Fix minitest on CI
1 parent 3aaf4c3 commit 1efe8b9

File tree

4 files changed

+38
-21
lines changed

4 files changed

+38
-21
lines changed

.github/workflows/tests.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
submodules: recursive
2727
fetch-depth: 0
2828
fetch-tags: true
29+
- name: Install dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y pkgconfig libcurl4-openssl-dev
2933
- uses: ruby/setup-ruby@v1
3034
with:
3135
ruby-version: 3.3
@@ -109,6 +113,7 @@ jobs:
109113
make \
110114
openssl \
111115
openssl-dev \
116+
curl-dev \
112117
readline-dev \
113118
ruby \
114119
tar \
@@ -555,6 +560,15 @@ jobs:
555560
logs/*
556561
test/**/*.{log,xml}
557562
retention-days: 5
563+
- name: Upload crash logs
564+
if: failure()
565+
uses: actions/upload-artifact@v4
566+
with:
567+
name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-crash
568+
path: |
569+
~/Library/Logs/DiagnosticReports/
570+
/Library/Logs/DiagnosticReports/
571+
retention-days: 5
558572
- name: Publish Test Report
559573
uses: mikepenz/[email protected]
560574
if: always()
@@ -616,6 +630,15 @@ jobs:
616630
logs/*
617631
test/**/*.{log,xml}
618632
retention-days: 5
633+
- name: Upload crash logs
634+
if: failure()
635+
uses: actions/upload-artifact@v4
636+
with:
637+
name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-crash
638+
path: |
639+
~/Library/Logs/DiagnosticReports/
640+
/Library/Logs/DiagnosticReports/
641+
retention-days: 5
619642
- name: Publish Test Report
620643
uses: mikepenz/[email protected]
621644
if: always()

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
/pkg/
1919
/test/reports/
2020
/tmp/
21+
/logs/
2122
/vendor/bundle/
2223
Gemfile.lock
2324
Makefile

Gemfile

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ gem "rake"
2323

2424
group :development do
2525
gem "activesupport", "~> 7.0.3"
26+
gem "curb"
2627
gem "drb"
2728
gem "faker"
2829
gem "flay"
2930
gem "flog"
3031
gem "gem-compiler"
3132
gem "grpc-tools", "~> 1.59"
3233
gem "heckle"
33-
gem "minitest"
34+
gem "minitest", "< 6.0"
3435
gem "minitest-reporters"
3536
gem "mutex_m"
3637
gem "rack"
@@ -44,15 +45,4 @@ group :development do
4445
gem "ruby-lsp", require: false
4546
gem "simplecov-cobertura"
4647
gem "yard"
47-
48-
# Resolves https://github.com/ruby/openssl/issues/949 which we encounter when downloading gocaves on macOS on CI
49-
# This has been fixed in openssl versions 3.1.2, 3.2.2, 3.3.1.
50-
# The latest dot-patch version of Ruby 3.3 and 3.4 now comes with a new enough openssl version by default.
51-
if RUBY_PLATFORM.include?("darwin")
52-
if RUBY_VERSION.start_with?('3.2')
53-
gem "openssl", "~> 3.2.2"
54-
elsif RUBY_VERSION.start_with?('3.1')
55-
gem "openssl", "~> 3.1.2"
56-
end
57-
end
5848
end

test/mock_helper.rb

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,33 @@
2020
require "fileutils"
2121
require "tmpdir"
2222
require "socket"
23+
require "curb"
2324

2425
class Caves
2526
attr_accessor :verbose
2627

27-
VERSION = "v0.0.1-78"
28+
VERSION = "v0.0.1-79"
2829
FORK = "couchbaselabs"
2930

3031
def download_mock(url = caves_url)
3132
return if binary_ready?
3233

3334
puts "download #{url}"
34-
resp = Net::HTTP.get_response(URI.parse(url))
3535

36-
case resp
37-
when Net::HTTPSuccess
38-
raise "Unexpected content type: #{resp['content-type']}" if resp["content-type"] != "application/octet-stream"
36+
curl = Curl::Easy.new(url) do |c|
37+
c.follow_location = true
38+
c.max_redirects = 5
39+
end
40+
curl.perform
3941

42+
case curl.response_code
43+
when 200..299
44+
raise "Unexpected content type: #{curl.content_type}" if curl.content_type != "application/octet-stream"
4045
FileUtils.mkdir_p(caves_dir, verbose: verbose?)
41-
File.write(mock_path, resp.body, binmode: true)
46+
File.write(mock_path, curl.body, binmode: true)
4247
FileUtils.chmod("a+x", mock_path, verbose: verbose?) unless windows?
43-
when Net::HTTPRedirection
44-
download_mock(resp["location"])
4548
else
46-
raise "Unable to download mock from #{url}: #{resp.status}"
49+
raise "Unable to download mock from #{url}: #{curl.response_code}"
4750
end
4851
end
4952

0 commit comments

Comments
 (0)