Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Gemfile & Dockerfile to get passing tests #1732

Merged
merged 4 commits into from
Oct 30, 2024

Conversation

ransombriggs
Copy link
Contributor

Summary

This tweaks the Dockerfile and Gemfile to get a passing docker build. This could probably be tweaked back more towards its original style, but it was much easier to debug when I could run the bundle process as the doorkeeper user.

@ThisIsMissEm
Copy link
Contributor

@nbulaj this works for me to get clean running tests; the only output besides success is:

DEPRECATION WARNING: Setting action_dispatch.show_exceptions to false is deprecated. Set to :none instead. (called from block (5 levels) in <top (required)> at /srv/spec/requests/endpoints/authorization_spec.rb:88)
DEPRECATION WARNING: Setting action_dispatch.show_exceptions to false is deprecated. Set to :none instead. (called from block (5 levels) in <top (required)> at /srv/spec/requests/endpoints/authorization_spec.rb:88)

@ThisIsMissEm
Copy link
Contributor

Changing as follows:

config.action_dispatch.show_exceptions = false

   # Raise exceptions instead of rendering exception templates
-  config.action_dispatch.show_exceptions = false
+  config.action_dispatch.show_exceptions = :none

Fixes that one issue.

@ThisIsMissEm
Copy link
Contributor

One downside of this is that for every change you make, you need to rebuild the container image, which means reinstalling all the gems, even if they've not changed.

@ransombriggs
Copy link
Contributor Author

@ThisIsMissEm I tweaked it back towards the original with no rebuild in 83e6a47

@nbulaj I had to add Gemfile.lock to the docker ignore because my locally git ignored version was causing issues and was out of date compared to the one on the docker image so one test failed. It might be good to add a Gemfile.lock to versioning so that we get predictable gem versions when building / running specs.

WORKDIR /srv

COPY Gemfile doorkeeper.gemspec /srv/
COPY lib/doorkeeper/version.rb /srv/lib/doorkeeper/version.rb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, I tried hacking this whilst working on #1735 and didn't quite get it right, I was doing:

 COPY Gemfile Gemfile.lock doorkeeper.gemspec lib/doorkeeper/version.rb /srv/

And it was failing to load the version file; I guess this explains why!

@ThisIsMissEm
Copy link
Contributor

I think the test change and the errors are because you're not doing bundle exec rake but I might be wrong here.

@ransombriggs
Copy link
Contributor Author

I think the test change and the errors are because you're not doing bundle exec rake but I might be wrong here.

I double-checked and that is not the issue and would include what Gemfile.lock change caused this but I deleted my local one :(

@ThisIsMissEm
Copy link
Contributor

@ransombriggs if it helps, this is my local gemfile.lock?

Gemfile.lock
PATH
  remote: .
  specs:
    doorkeeper (5.7.1)
      railties (>= 5)

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (7.1.3.4)
      actionpack (= 7.1.3.4)
      activesupport (= 7.1.3.4)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
      zeitwerk (~> 2.6)
    actionmailbox (7.1.3.4)
      actionpack (= 7.1.3.4)
      activejob (= 7.1.3.4)
      activerecord (= 7.1.3.4)
      activestorage (= 7.1.3.4)
      activesupport (= 7.1.3.4)
      mail (>= 2.7.1)
      net-imap
      net-pop
      net-smtp
    actionmailer (7.1.3.4)
      actionpack (= 7.1.3.4)
      actionview (= 7.1.3.4)
      activejob (= 7.1.3.4)
      activesupport (= 7.1.3.4)
      mail (~> 2.5, >= 2.5.4)
      net-imap
      net-pop
      net-smtp
      rails-dom-testing (~> 2.2)
    actionpack (7.1.3.4)
      actionview (= 7.1.3.4)
      activesupport (= 7.1.3.4)
      nokogiri (>= 1.8.5)
      racc
      rack (>= 2.2.4)
      rack-session (>= 1.0.1)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.2)
      rails-html-sanitizer (~> 1.6)
    actiontext (7.1.3.4)
      actionpack (= 7.1.3.4)
      activerecord (= 7.1.3.4)
      activestorage (= 7.1.3.4)
      activesupport (= 7.1.3.4)
      globalid (>= 0.6.0)
      nokogiri (>= 1.8.5)
    actionview (7.1.3.4)
      activesupport (= 7.1.3.4)
      builder (~> 3.1)
      erubi (~> 1.11)
      rails-dom-testing (~> 2.2)
      rails-html-sanitizer (~> 1.6)
    activejob (7.1.3.4)
      activesupport (= 7.1.3.4)
      globalid (>= 0.3.6)
    activemodel (7.1.3.4)
      activesupport (= 7.1.3.4)
    activerecord (7.1.3.4)
      activemodel (= 7.1.3.4)
      activesupport (= 7.1.3.4)
      timeout (>= 0.4.0)
    activestorage (7.1.3.4)
      actionpack (= 7.1.3.4)
      activejob (= 7.1.3.4)
      activerecord (= 7.1.3.4)
      activesupport (= 7.1.3.4)
      marcel (~> 1.0)
    activesupport (7.1.3.4)
      base64
      bigdecimal
      concurrent-ruby (~> 1.0, >= 1.0.2)
      connection_pool (>= 2.2.5)
      drb
      i18n (>= 1.6, < 2)
      minitest (>= 5.1)
      mutex_m
      tzinfo (~> 2.0)
    addressable (2.8.7)
      public_suffix (>= 2.0.2, < 7.0)
    appraisal (2.5.0)
      bundler
      rake
      thor (>= 0.14.0)
    ast (2.4.2)
    base64 (0.2.0)
    bcrypt (3.1.20)
    bigdecimal (3.1.8)
    builder (3.3.0)
    capybara (3.40.0)
      addressable
      matrix
      mini_mime (>= 0.1.3)
      nokogiri (~> 1.11)
      rack (>= 1.6.0)
      rack-test (>= 0.6.3)
      regexp_parser (>= 1.5, < 3.0)
      xpath (~> 3.2)
    concurrent-ruby (1.3.3)
    connection_pool (2.4.1)
    coveralls_reborn (0.28.0)
      simplecov (~> 0.22.0)
      term-ansicolor (~> 1.7)
      thor (~> 1.2)
      tins (~> 1.32)
    crass (1.0.6)
    database_cleaner (2.0.2)
      database_cleaner-active_record (>= 2, < 3)
    database_cleaner-active_record (2.2.0)
      activerecord (>= 5.a)
      database_cleaner-core (~> 2.0.0)
    database_cleaner-core (2.0.1)
    date (3.3.4)
    debug (1.9.2)
      irb (~> 1.10)
      reline (>= 0.3.8)
    diff-lcs (1.5.1)
    docile (1.4.1)
    drb (2.2.1)
    dry-core (1.0.1)
      concurrent-ruby (~> 1.0)
      zeitwerk (~> 2.6)
    dry-inflector (1.1.0)
    dry-logic (1.5.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 1.0, < 2)
      zeitwerk (~> 2.6)
    dry-types (1.7.2)
      bigdecimal (~> 3.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 1.0)
      dry-inflector (~> 1.0)
      dry-logic (~> 1.4)
      zeitwerk (~> 2.6)
    erubi (1.13.0)
    factory_bot (6.4.6)
      activesupport (>= 5.0.0)
    generator_spec (0.10.0)
      activesupport (>= 3.0.0)
      railties (>= 3.0.0)
    globalid (1.2.1)
      activesupport (>= 6.1)
    grape (2.1.3)
      activesupport (>= 6)
      dry-types (>= 1.1)
      mustermann-grape (~> 1.1.0)
      rack (>= 2)
      zeitwerk
    i18n (1.14.5)
      concurrent-ruby (~> 1.0)
    io-console (0.7.2)
    irb (1.14.0)
      rdoc (>= 4.0.0)
      reline (>= 0.4.2)
    json (2.7.2)
    language_server-protocol (3.17.0.3)
    loofah (2.22.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.12.0)
    mail (2.8.1)
      mini_mime (>= 0.1.1)
      net-imap
      net-pop
      net-smtp
    marcel (1.0.4)
    matrix (0.4.2)
    mini_mime (1.1.5)
    minitest (5.24.1)
    mize (0.6.0)
    mustermann (3.0.0)
      ruby2_keywords (~> 0.0.1)
    mustermann-grape (1.1.0)
      mustermann (>= 1.0.0)
    mutex_m (0.2.0)
    net-imap (0.4.14)
      date
      net-protocol
    net-pop (0.1.2)
      net-protocol
    net-protocol (0.2.2)
      timeout
    net-smtp (0.5.0)
      net-protocol
    nio4r (2.7.3)
    nokogiri (1.16.6-aarch64-linux)
      racc (~> 1.4)
    nokogiri (1.16.6-arm-linux)
      racc (~> 1.4)
    nokogiri (1.16.6-arm64-darwin)
      racc (~> 1.4)
    nokogiri (1.16.6-x86-linux)
      racc (~> 1.4)
    nokogiri (1.16.6-x86_64-darwin)
      racc (~> 1.4)
    nokogiri (1.16.6-x86_64-linux)
      racc (~> 1.4)
    parallel (1.25.1)
    parser (3.3.4.0)
      ast (~> 2.4.1)
      racc
    psych (5.1.2)
      stringio
    public_suffix (6.0.1)
    racc (1.8.0)
    rack (3.1.7)
    rack-session (2.0.0)
      rack (>= 3.0.0)
    rack-test (2.1.0)
      rack (>= 1.3)
    rackup (2.1.0)
      rack (>= 3)
      webrick (~> 1.8)
    rails (7.1.3.4)
      actioncable (= 7.1.3.4)
      actionmailbox (= 7.1.3.4)
      actionmailer (= 7.1.3.4)
      actionpack (= 7.1.3.4)
      actiontext (= 7.1.3.4)
      actionview (= 7.1.3.4)
      activejob (= 7.1.3.4)
      activemodel (= 7.1.3.4)
      activerecord (= 7.1.3.4)
      activestorage (= 7.1.3.4)
      activesupport (= 7.1.3.4)
      bundler (>= 1.15.0)
      railties (= 7.1.3.4)
    rails-dom-testing (2.2.0)
      activesupport (>= 5.0.0)
      minitest
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.6.0)
      loofah (~> 2.21)
      nokogiri (~> 1.14)
    railties (7.1.3.4)
      actionpack (= 7.1.3.4)
      activesupport (= 7.1.3.4)
      irb
      rackup (>= 1.0.0)
      rake (>= 12.2)
      thor (~> 1.0, >= 1.2.2)
      zeitwerk (~> 2.6)
    rainbow (3.1.1)
    rake (13.2.1)
    rdoc (6.7.0)
      psych (>= 4.0.0)
    regexp_parser (2.9.2)
    reline (0.5.9)
      io-console (~> 0.5)
    rexml (3.3.2)
      strscan
    rspec-core (3.13.0)
      rspec-support (~> 3.13.0)
    rspec-expectations (3.13.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.13.0)
    rspec-mocks (3.13.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.13.0)
    rspec-rails (7.0.1)
      actionpack (>= 7.0)
      activesupport (>= 7.0)
      railties (>= 7.0)
      rspec-core (~> 3.13)
      rspec-expectations (~> 3.13)
      rspec-mocks (~> 3.13)
      rspec-support (~> 3.13)
    rspec-support (3.13.1)
    rubocop (1.65.0)
      json (~> 2.3)
      language_server-protocol (>= 3.17.0)
      parallel (~> 1.10)
      parser (>= 3.3.0.2)
      rainbow (>= 2.2.2, < 4.0)
      regexp_parser (>= 2.4, < 3.0)
      rexml (>= 3.2.5, < 4.0)
      rubocop-ast (>= 1.31.1, < 2.0)
      ruby-progressbar (~> 1.7)
      unicode-display_width (>= 2.4.0, < 3.0)
    rubocop-ast (1.31.3)
      parser (>= 3.3.1.0)
    rubocop-performance (1.21.1)
      rubocop (>= 1.48.1, < 2.0)
      rubocop-ast (>= 1.31.1, < 2.0)
    rubocop-rails (2.25.1)
      activesupport (>= 4.2.0)
      rack (>= 1.1)
      rubocop (>= 1.33.0, < 2.0)
      rubocop-ast (>= 1.31.1, < 2.0)
    rubocop-rspec (3.0.3)
      rubocop (~> 1.61)
    ruby-progressbar (1.13.0)
    ruby2_keywords (0.0.5)
    simplecov (0.22.0)
      docile (~> 1.1)
      simplecov-html (~> 0.11)
      simplecov_json_formatter (~> 0.1)
    simplecov-html (0.12.3)
    simplecov_json_formatter (0.1.4)
    sprockets (4.2.1)
      concurrent-ruby (~> 1.0)
      rack (>= 2.2.4, < 4)
    sprockets-rails (3.5.1)
      actionpack (>= 6.1)
      activesupport (>= 6.1)
      sprockets (>= 3.0.0)
    sqlite3 (1.7.3-aarch64-linux)
    sqlite3 (1.7.3-arm-linux)
    sqlite3 (1.7.3-arm64-darwin)
    sqlite3 (1.7.3-x86-linux)
    sqlite3 (1.7.3-x86_64-darwin)
    sqlite3 (1.7.3-x86_64-linux)
    stringio (3.1.1)
    strscan (3.1.0)
    sync (0.5.0)
    term-ansicolor (1.10.4)
      mize (~> 0.5)
      tins (~> 1.0)
    thor (1.3.1)
    timecop (0.9.10)
    timeout (0.4.1)
    tins (1.33.0)
      bigdecimal
      sync
    tzinfo (2.0.6)
      concurrent-ruby (~> 1.0)
    unicode-display_width (2.5.0)
    webrick (1.8.1)
    websocket-driver (0.7.6)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    xpath (3.2.0)
      nokogiri (~> 1.8)
    zeitwerk (2.6.16)

PLATFORMS
  aarch64-linux
  aarch64-linux-gnu
  aarch64-linux-musl
  arm-linux
  arm-linux-gnu
  arm-linux-musl
  arm64-darwin
  x86-linux
  x86-linux-gnu
  x86-linux-musl
  x86_64-darwin
  x86_64-linux
  x86_64-linux-gnu
  x86_64-linux-musl

DEPENDENCIES
  activerecord-jdbcsqlite3-adapter
  appraisal
  bcrypt (~> 3.1)
  capybara
  coveralls_reborn
  database_cleaner (~> 2.0)
  debug (~> 1.8)
  doorkeeper!
  factory_bot (~> 6.0)
  generator_spec (~> 0.10.0)
  grape
  irb (~> 1.8)
  rails (>= 6.0, < 7.3)
  rake (>= 11.3.0)
  rspec-core
  rspec-expectations
  rspec-mocks
  rspec-rails (~> 7.0)
  rspec-support
  rubocop (~> 1.4)
  rubocop-performance
  rubocop-rails
  rubocop-rspec
  sprockets-rails
  sqlite3 (~> 1.4)
  timecop
  tzinfo-data

BUNDLED WITH
   2.5.11

@nbulaj
Copy link
Member

nbulaj commented Oct 18, 2024

hey 👋

Hm interesting, some new failed test:

 ActionController::InvalidAuthenticityToken:
       Can't verify CSRF token authenticity.

Have to 👁️ on that test

@ransombriggs
Copy link
Contributor Author

ransombriggs commented Oct 18, 2024

@nbulaj I fixed the spec in a33a90a, I think it may have been an issue cause by my Gemfile.lock being used in the image.

@nbulaj
Copy link
Member

nbulaj commented Oct 24, 2024

I fixed the spec in a33a90a, I think it may have been an issue cause by my Gemfile.lock being used in the image.

Do we have this commit anywhere in some PR? This error looks noisy now 😞

@ransombriggs
Copy link
Contributor Author

That is confusing when you click on it, but that commit is the "Revert authorization_spec changes" commit in this PR. This test changes behavior with a certain version of a gem, I forget which though, since I deleted my Gemfile.lock when debugging.

@stanhu
Copy link
Contributor

stanhu commented Oct 25, 2024

The spec failures are fixed by #1742. Rebase main.

@ransombriggs
Copy link
Contributor Author

I merged in main and it looks like everything is passing now

Copy link
Member

@nbulaj nbulaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@nbulaj nbulaj merged commit 4ca1d55 into doorkeeper-gem:main Oct 30, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants