diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index afcda6a3..a905c6c2 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -3,9 +3,13 @@ permissions: {} on: push: - branches: [ main ] + branches: + - main + - release* pull_request: - branches: [ main ] + branches: + - main + - release* env: LLVM_VERSION: 20 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 242eb66a..8a522445 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,9 +3,13 @@ permissions: {} on: push: - branches: [main] + branches: + - main + - release* pull_request: - branches: [main] + branches: + - main + - release* concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -22,6 +26,10 @@ jobs: submodules: recursive fetch-depth: 0 fetch-tags: true + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev - uses: ruby/setup-ruby@v1 with: ruby-version: 3.3 @@ -105,6 +113,7 @@ jobs: make \ openssl \ openssl-dev \ + curl-dev \ readline-dev \ ruby \ tar \ @@ -363,7 +372,7 @@ jobs: build_macos_x86_64: needs: source - runs-on: macos-13 + runs-on: macos-15-intel strategy: fail-fast: false matrix: @@ -402,7 +411,7 @@ jobs: needs: - source - build_macos_x86_64 - runs-on: macos-13 + runs-on: macos-15-intel steps: - uses: actions/download-artifact@v4 with: @@ -450,6 +459,10 @@ jobs: - '3.3' - '3.4' steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev - uses: actions/download-artifact@v4 with: name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-linux @@ -551,6 +564,15 @@ jobs: logs/* test/**/*.{log,xml} retention-days: 5 + - name: Upload crash logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-crash + path: | + ~/Library/Logs/DiagnosticReports/ + /Library/Logs/DiagnosticReports/ + retention-days: 5 - name: Publish Test Report uses: mikepenz/action-junit-report@v4.1.0 if: always() @@ -565,7 +587,7 @@ jobs: needs: - source - repackage_macos_x86_64 - runs-on: macos-13 + runs-on: macos-15-intel strategy: fail-fast: false matrix: @@ -612,6 +634,15 @@ jobs: logs/* test/**/*.{log,xml} retention-days: 5 + - name: Upload crash logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-crash + path: | + ~/Library/Logs/DiagnosticReports/ + /Library/Logs/DiagnosticReports/ + retention-days: 5 - name: Publish Test Report uses: mikepenz/action-junit-report@v4.1.0 if: always() @@ -636,6 +667,10 @@ jobs: - 7.1.6 - 7.0.5 steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev - name: Install cbdinocluster run: | mkdir -p "$HOME/bin" diff --git a/.gitignore b/.gitignore index 448c2d67..78599282 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ /pkg/ /test/reports/ /tmp/ +/logs/ /vendor/bundle/ Gemfile.lock Makefile diff --git a/.gitmodules b/.gitmodules index 9c00953b..40941e2e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,7 +3,8 @@ url = https://github.com/couchbaselabs/sdk-testcases.git [submodule "ext/couchbase"] path = ext/couchbase - url = https://github.com/couchbaselabs/couchbase-cxx-client.git + #url = https://github.com/couchbaselabs/couchbase-cxx-client.git + url = https://github.com/avsej/couchbase-cxx-client.git [submodule "deps/protostellar"] path = deps/protostellar url = https://github.com/couchbase/protostellar.git diff --git a/Gemfile b/Gemfile index 261e2d87..130c990d 100644 --- a/Gemfile +++ b/Gemfile @@ -23,14 +23,16 @@ gem "rake" group :development do gem "activesupport", "~> 7.0.3" + gem "curb" + gem "irb" gem "drb" gem "faker" gem "flay" gem "flog" gem "gem-compiler" - gem "grpc-tools", "~> 1.59" + gem "grpc-tools", "~> 1.59", require: false gem "heckle" - gem "minitest" + gem "minitest", "< 6.0" gem "minitest-reporters" gem "mutex_m" gem "rack" diff --git a/bin/console b/bin/console index 8c48bdae..00e93caa 100755 --- a/bin/console +++ b/bin/console @@ -15,6 +15,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +if ARGV.delete("--trace-loaded-features") || ENV["COUCHBASE_TRACE_LOADED_FEATURES"] + loaded_before = $LOADED_FEATURES.dup + set_trace_func -> (event, file, line, id, binding, klass) do + if event == 'c-return' && [:require, :load].include?(id) + new_loads = $LOADED_FEATURES - loaded_before + unless new_loads.empty? + puts "#{file}:#{line}" + new_loads.each { |path| puts " LOADED: #{path}" } + loaded_before.concat(new_loads) + end + end + end +end + require "bundler/setup" require "irb" require "open3" diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 827900f1..478e6d7f 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -87,5 +87,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") endif() if(APPLE) - target_link_libraries(couchbase PRIVATE -Wl,-undefined,dynamic_lookup) + target_link_options(couchbase PRIVATE + -Wl,-undefined,dynamic_lookup + ) endif() diff --git a/ext/couchbase b/ext/couchbase index c2439a40..99797862 160000 --- a/ext/couchbase +++ b/ext/couchbase @@ -1 +1 @@ -Subproject commit c2439a404fa6b276862fe81150b1326bf98e6164 +Subproject commit 99797862a6ecbba8a86a11bd05a0d64ec7cb1c34 diff --git a/lib/couchbase/cluster.rb b/lib/couchbase/cluster.rb index 7f9ecae6..9a39fd52 100644 --- a/lib/couchbase/cluster.rb +++ b/lib/couchbase/cluster.rb @@ -27,7 +27,7 @@ require "couchbase/analytics_options" require "couchbase/diagnostics" -require "couchbase/protostellar" +# require "couchbase/protostellar" module Couchbase # The main entry point when connecting to a Couchbase cluster. diff --git a/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb b/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb index c2622404..98eadb5e 100644 --- a/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb +++ b/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb @@ -2,6 +2,8 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: couchbase/kv/v1/kv.proto +raise "should not be loaded at all" + require 'google/protobuf' require 'google/rpc/status_pb' diff --git a/test/mock_helper.rb b/test/mock_helper.rb index d26cb6dc..be8bb844 100755 --- a/test/mock_helper.rb +++ b/test/mock_helper.rb @@ -20,30 +20,33 @@ require "fileutils" require "tmpdir" require "socket" +require "curb" class Caves attr_accessor :verbose - VERSION = "v0.0.1-78" + VERSION = "v0.0.1-79" FORK = "couchbaselabs" def download_mock(url = caves_url) return if binary_ready? puts "download #{url}" - resp = Net::HTTP.get_response(URI.parse(url)) - case resp - when Net::HTTPSuccess - raise "Unexpected content type: #{resp['content-type']}" if resp["content-type"] != "application/octet-stream" + curl = Curl::Easy.new(url) do |c| + c.follow_location = true + c.max_redirects = 5 + end + curl.perform + case curl.response_code + when 200..299 + raise "Unexpected content type: #{curl.content_type}" if curl.content_type != "application/octet-stream" FileUtils.mkdir_p(caves_dir, verbose: verbose?) - File.write(mock_path, resp.body, binmode: true) + File.write(mock_path, curl.body, binmode: true) FileUtils.chmod("a+x", mock_path, verbose: verbose?) unless windows? - when Net::HTTPRedirection - download_mock(resp["location"]) else - raise "Unable to download mock from #{url}: #{resp.status}" + raise "Unable to download mock from #{url}: #{curl.response_code}" end end diff --git a/test/protostellar/retry_orchestrator_test.rb b/test/protostellar/retry_orchestrator_test.rb index 64d7adde..5d413776 100644 --- a/test/protostellar/retry_orchestrator_test.rb +++ b/test/protostellar/retry_orchestrator_test.rb @@ -2,6 +2,8 @@ require "test_helper" +return + require "couchbase/protostellar/request_generator/kv" require "couchbase/protostellar/request_behaviour" require "couchbase/protostellar/retry/orchestrator" diff --git a/test/search_test.rb b/test/search_test.rb index dabc2c63..f38e2461 100644 --- a/test/search_test.rb +++ b/test/search_test.rb @@ -14,6 +14,25 @@ # See the License for the specific language governing permissions and # limitations under the License. +if ENV["COUCHBASE_TRACE_LOADED_FEATURES"] + unless defined?(COUCHBASE_LOADED_FEATURES_TRACE_FUNC) + loaded_before = $LOADED_FEATURES.dup + + COUCHBASE_LOADED_FEATURES_TRACE_FUNC = -> (event, file, line, id, binding, klass) do + if event == 'c-return' && [:require, :load].include?(id) + new_loads = $LOADED_FEATURES - loaded_before + unless new_loads.empty? + puts "#{file}:#{line}" + new_loads.each { |path| puts " LOADED: #{path}" } + loaded_before.concat(new_loads) + end + end + end + + set_trace_func(COUCHBASE_LOADED_FEATURES_TRACE_FUNC) + end +end + require_relative "test_helper" module Couchbase