From e90e539e0556b8482e20336118be048288dfa31f Mon Sep 17 00:00:00 2001 From: Andrey Morskov Date: Mon, 9 Nov 2026 16:45:39 +0200 Subject: [PATCH 1/4] CORE-2764: replace MinIO with SeaweedFS in CI and the dev compose MinIO publishes no community images any more. This moves the S3 stand-in used by the specs to SeaweedFS 4.48 (`weed mini`), the store Wallarm's devenv already runs. - .github/workflows/ci.yaml: SeaweedFS replaces the minio container on localhost:9000 (-s3.port=9000), with the same minioadmin key pair as its static admin identity and -bucket=test instead of the mkdir trick. Readiness is an authenticated HEAD on the bucket (curl --aws-sigv4); the wait step now fails the job when the services never come up, where it used to fall through. - docker/docker-compose.yml: same s3 service for dip, keeping the name and port 9000 so S3_ENDPOINT stays http://s3:9000; the app waits for its healthcheck. The ../uploads/s3 bind mount is gone: it held MinIO's on-disk layout, and the specs need no persistence. - -s3.autoCreateBucket=false: SeaweedFS otherwise creates a missing bucket on the first upload by an admin identity, where AWS answers NoSuchBucket. - dip.yml: drop the mkdir of uploads/s3. - .circleci/config.yml removed: GitHub Actions runs the same rubocop and rspec job on a wider Ruby matrix. Verified: bundle exec rspec in the dip app container against the new compose, 58 examples, 0 failures, twice. --- .circleci/config.yml | 49 --------------------------------------- .github/workflows/ci.yaml | 18 +++++++++----- dip.yml | 1 - docker/docker-compose.yml | 21 ++++++++++++----- 4 files changed, 27 insertions(+), 62 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 99e111e..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,49 +0,0 @@ -version: 2.1 -jobs: - test: - parameters: - ruby_version: - type: string - resource_class: small - docker: - - image: cimg/ruby:<< parameters.ruby_version >> - environment: - - S3_ENDPOINT=http://localhost:9000 - - S3_BUCKET=test - - GCS_ENDPOINT=http://localhost:8080/ - - GCS_BUCKET=some-bucket - - image: minio/minio:edge - entrypoint: sh - command: -c 'mkdir -p /data/test && minio server /data --json' - - image: fsouza/fake-gcs-server - entrypoint: sh - command: > - -c 'mkdir -p /data/some-bucket && - /bin/fake-gcs-server -port 8080 -scheme http -external-url=http://localhost:8080 -public-host=localhost:8080 -filesystem-root /data - ' - steps: - - checkout - - run: - name: setup env - command: gem install bundler && ruby -v && bundle -v - - run: - name: bundle install - command: bundle install - - run: - name: Test syntax with rubocop - command: bundle exec ./rubocop --display-style-guide --extra-details - - run: - name: Run tests - command: bundle exec rspec -references: - matrix_test: &matrix_test - test: - matrix: - parameters: - ruby_version: ["2.5", "2.7", "3.0", "3.1"] - -workflows: - version: 2 - build_and_test: - jobs: - - <<: *matrix_test diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 74482a8..7429ece 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,13 +22,16 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Start MinIO + - name: Start SeaweedFS run: | - docker run -d --name minio \ + docker run -d --name seaweedfs \ -p 9000:9000 \ - --entrypoint sh \ - minio/minio:RELEASE.2025-04-22T22-12-26Z \ - -c 'mkdir -p /data/test && minio server /data --json' + -e AWS_ACCESS_KEY_ID=minioadmin \ + -e AWS_SECRET_ACCESS_KEY=minioadmin \ + docker.io/chrislusf/seaweedfs:4.48 \ + mini -dir=/data -webdav=false -admin.ui=false \ + -s3.port=9000 -s3.port.iceberg=0 -s3.port.lance=0 -s3.autoCreateBucket=false \ + -bucket=test - name: Start fake-gcs-server run: | @@ -41,9 +44,12 @@ jobs: - name: Wait for services run: | for i in $(seq 1 30); do - curl -sf http://localhost:9000/minio/health/live && curl -sf http://localhost:8080/ && break + curl -sfI --aws-sigv4 aws:amz:us-east-1:s3 --user minioadmin:minioadmin http://localhost:9000/test \ + && curl -sf http://localhost:8080/ && exit 0 sleep 1 done + echo "SeaweedFS or fake-gcs-server did not become ready" >&2 + exit 1 - name: Set up Ruby ${{ matrix.ruby-version }} uses: ruby/setup-ruby@v1 diff --git a/dip.yml b/dip.yml index a45b238..fe0bff1 100644 --- a/dip.yml +++ b/dip.yml @@ -34,7 +34,6 @@ interaction: provision: - ./docker/prepare_env.sh - - mkdir -p uploads/s3/$S3_BUCKET - rm -rf uploads/gcs/$GCS_BUCKET - rm -rf Gemfile.lock - mkdir -p uploads/gcs/$GCS_BUCKET diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index a43b10d..db31384 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -20,14 +20,23 @@ services: - bundler-data:/bundle command: sh depends_on: - - s3 - - gcs + s3: + condition: service_healthy + gcs: + condition: service_started s3: - image: minio/minio:RELEASE.2025-04-22T22-12-26Z - volumes: - - ../uploads/s3:/data - command: server /data --json + image: docker.io/chrislusf/seaweedfs:4.48 + command: ["mini", "-dir=/data", "-webdav=false", "-admin.ui=false", + "-s3.port=9000", "-s3.port.iceberg=0", "-s3.port.lance=0", "-s3.autoCreateBucket=false", + "-bucket=${S3_BUCKET}"] + environment: + AWS_ACCESS_KEY_ID: minioadmin + AWS_SECRET_ACCESS_KEY: minioadmin + healthcheck: + test: ["CMD-SHELL", "for b in ${S3_BUCKET}; do curl -sfI --aws-sigv4 aws:amz:us-east-1:s3 --user \"$$AWS_ACCESS_KEY_ID:$$AWS_SECRET_ACCESS_KEY\" http://localhost:9000/$$b || exit 1; done"] + interval: 1s + retries: 30 gcs: image: fsouza/fake-gcs-server From cb030222fdf53ade84ca5881bfba54257ea0d405 Mon Sep 17 00:00:00 2001 From: Andrey Morskov Date: Mon, 9 Nov 2026 17:02:02 +0200 Subject: [PATCH 2/4] CORE-2764: probe fake-gcs-server readiness on its bucket fake-gcs-server answers 404 on /, so the wait step's curl never succeeded: the loop always ran its 30 attempts and fell through, which went unnoticed until the step started failing the job when the services never come up. The bucket endpoint answers 200 once the server is up. --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7429ece..b7e48d3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,7 +45,7 @@ jobs: run: | for i in $(seq 1 30); do curl -sfI --aws-sigv4 aws:amz:us-east-1:s3 --user minioadmin:minioadmin http://localhost:9000/test \ - && curl -sf http://localhost:8080/ && exit 0 + && curl -sf "http://localhost:8080/storage/v1/b/$GCS_BUCKET" >/dev/null && exit 0 sleep 1 done echo "SeaweedFS or fake-gcs-server did not become ready" >&2 From 0d05c2bcf0f32ae5f3d211e6afe620f309448ddf Mon Sep 17 00:00:00 2001 From: Andrey Morskov Date: Mon, 9 Nov 2026 17:04:34 +0200 Subject: [PATCH 3/4] Satisfy RSpec/MatchWithSimpleRegex in the GCS signed-URL spec CI installs the newest gems (no Gemfile.lock in git), and rubocop-rspec 3.10.2 flags match(/GoogleAccessId=/), which failed the Rubocop step before rspec ran. include('GoogleAccessId=') is the cop's own autocorrection and asserts the same thing. --- spec/cloud_storage/objects/gcs_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/cloud_storage/objects/gcs_spec.rb b/spec/cloud_storage/objects/gcs_spec.rb index b0a78c3..478189f 100644 --- a/spec/cloud_storage/objects/gcs_spec.rb +++ b/spec/cloud_storage/objects/gcs_spec.rb @@ -23,7 +23,7 @@ subject(:url) { obj.signed_url(expires_in: 30, issuer: 'max@tretyakov-ma.ru', signing_key: key, version: :v2) } it { is_expected.to match(%r{\A#{ENV.fetch('GCS_ENDPOINT')}#{ENV.fetch('GCS_BUCKET')}/test_1.txt}) } - it { is_expected.to match(/GoogleAccessId=/) } + it { is_expected.to include('GoogleAccessId=') } end end From d0ff228edc4a28c20c0da550b0b725da209f02ba Mon Sep 17 00:00:00 2001 From: Andrey Morskov Date: Mon, 9 Nov 2026 17:07:16 +0200 Subject: [PATCH 4/4] CORE-2764: cover the S3 wrapper's rejected-request branches with a stub exist? and find rescue BadRequest/InvalidBucketName for an invalid bucket name. MinIO answered HEAD on invalid_bucket with 400, so the existing specs reached those rescues; SeaweedFS answers 404, exists? returns false without raising, and the two rescue lines went uncovered, putting line coverage at 94.90% under the 95% minimum. Two specs now drive the branch with stub_responses (head_object: BadRequest), so it is covered whatever the S3 stand-in answers. --- spec/cloud_storage/wrappers/s3_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/cloud_storage/wrappers/s3_spec.rb b/spec/cloud_storage/wrappers/s3_spec.rb index c0351da..8f6ff95 100644 --- a/spec/cloud_storage/wrappers/s3_spec.rb +++ b/spec/cloud_storage/wrappers/s3_spec.rb @@ -135,6 +135,14 @@ it { expect(cli.exist?('file.txt')).to be(false) } end + + # Servers differ on an invalid bucket name (400 on AWS and MinIO, 404 on + # SeaweedFS), so the error branch is driven by a stubbed client. + context 'when S3 rejects the request' do + let(:cli) { described_class.new(bucket: 'invalid_bucket', stub_responses: { head_object: 'BadRequest' }) } + + it { expect(cli.exist?('file.txt')).to be(false) } + end end describe '#find' do @@ -168,6 +176,16 @@ expect { cli.find('test6.txt') }.to raise_error(CloudStorage::ObjectNotFound, /test6.txt/) end end + + # Servers differ on an invalid bucket name (400 on AWS and MinIO, 404 on + # SeaweedFS), so the error branch is driven by a stubbed client. + context 'when S3 rejects the request' do + let(:cli) { described_class.new(bucket: 'invalid_bucket', stub_responses: { head_object: 'BadRequest' }) } + + it do + expect { cli.find('test6.txt') }.to raise_error(CloudStorage::ObjectNotFound, /test6.txt/) + end + end end describe '#delete_files' do