From ffd56de2e7cd1e2f5f3c7dcb558fface16b7b3d3 Mon Sep 17 00:00:00 2001 From: Tony Milan Date: Tue, 8 Sep 2026 13:49:05 +0100 Subject: [PATCH] includes smoke test in PR pipeline --- .github/workflows/smoke-test.yml | 46 ++++++++++++++++++++++++++++++++ Gemfile | 5 ++++ README.md | 5 ++++ 3 files changed, 56 insertions(+) create mode 100644 .github/workflows/smoke-test.yml diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml new file mode 100644 index 0000000..a76a08c --- /dev/null +++ b/.github/workflows/smoke-test.yml @@ -0,0 +1,46 @@ +name: Smoke Test + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + smoke: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + + # The gemspec pins bundler ~> 2.3.20, which conflicts with newer + # system bundler versions during dependency resolution. + - name: Install pinned bundler version + run: gem install bundler -v 2.3.27 --no-document + + - name: Install dependencies + run: bundle _2.3.27_ install + + # Uses the same connection options flywheel-app actually configures in + # production (request: :basic_auth) rather than this gem's own broken + # defaults - see README "Known Issues". + - name: Verify the gem builds a working connection + run: | + bundle _2.3.27_ exec ruby -Ilib -e ' + require "webpagetest" + options = { + request: :basic_auth, + response: :logger, + adapter: :net_http, + url: "https://example.com", + user: "smoke-test-user", + pass: "smoke-test-pass" + } + client = Webpagetest::Client.new(k: "demo", options: options) + raise "connection not built" unless client.connection.is_a?(Faraday::Connection) + puts "Loaded OK, connection built with production-style options" + ' diff --git a/Gemfile b/Gemfile index 76e587c..e265a24 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,8 @@ source 'https://rubygems.org' # Specify your gem's dependencies in webpagetest.gemspec gemspec + +# Faraday 2.x removed :basic_auth from core, which this gem's supported usage +# pattern depends on (see README "Known Issues"). Pinned here (dev/test only, +# not the gemspec) so CI reflects the version actually used in production. +gem "faraday", "~> 1.0" diff --git a/README.md b/README.md index bcb81ed..511d9a3 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,11 @@ Features included on the original gem (as of 2015): This gem is inspired by [Susuwatari](https://github.com/moviepilot/susuwatari) gem, so several ideas were taken from there (it's like a rewrite with some modifications). +## Known Issues + +`Webpagetest::Connection#get_connection` always calls `faraday.request options.request, options.user, options.pass`, passing `user`/`pass` as positional arguments regardless of which Faraday request middleware is configured. This is only valid for `:basic_auth`-style middleware; other middleware (including this gem's own default, `:url_encoded`) doesn't accept those extra arguments and raises `ArgumentError: wrong number of arguments`. + +**In practice:** as long as you always pass connection options with `request: :basic_auth` and real `user`/`pass` values (as shown in [Set up connection options for request](#set-up-connection-options-for-request) below), you won't hit this. It only breaks if you instantiate `Webpagetest::Client`/`Webpagetest.new` without custom `options:` (falling back to this gem's own defaults), or otherwise configure a request middleware other than `:basic_auth`. ## Installation