Skip to content

Commit a16047a

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

File tree

4 files changed

+46
-21
lines changed

4 files changed

+46
-21
lines changed

.github/workflows/tests.yml

Lines changed: 31 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 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 \
@@ -454,6 +459,10 @@ jobs:
454459
- '3.3'
455460
- '3.4'
456461
steps:
462+
- name: Install dependencies
463+
run: |
464+
sudo apt-get update
465+
sudo apt-get install -y libcurl4-openssl-dev
457466
- uses: actions/download-artifact@v4
458467
with:
459468
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-linux
@@ -555,6 +564,15 @@ jobs:
555564
logs/*
556565
test/**/*.{log,xml}
557566
retention-days: 5
567+
- name: Upload crash logs
568+
if: failure()
569+
uses: actions/upload-artifact@v4
570+
with:
571+
name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-crash
572+
path: |
573+
~/Library/Logs/DiagnosticReports/
574+
/Library/Logs/DiagnosticReports/
575+
retention-days: 5
558576
- name: Publish Test Report
559577
uses: mikepenz/[email protected]
560578
if: always()
@@ -616,6 +634,15 @@ jobs:
616634
logs/*
617635
test/**/*.{log,xml}
618636
retention-days: 5
637+
- name: Upload crash logs
638+
if: failure()
639+
uses: actions/upload-artifact@v4
640+
with:
641+
name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-crash
642+
path: |
643+
~/Library/Logs/DiagnosticReports/
644+
/Library/Logs/DiagnosticReports/
645+
retention-days: 5
619646
- name: Publish Test Report
620647
uses: mikepenz/[email protected]
621648
if: always()
@@ -640,6 +667,10 @@ jobs:
640667
- 7.1.6
641668
- 7.0.5
642669
steps:
670+
- name: Install dependencies
671+
run: |
672+
sudo apt-get update
673+
sudo apt-get install -y libcurl4-openssl-dev
643674
- name: Install cbdinocluster
644675
run: |
645676
mkdir -p "$HOME/bin"

.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)