Skip to content

Spec failed in `spec/features/projects/settings/repository_settings_spec.rb` | Projects > Settings > Repository settings for maintainer remote mirror settings creates a push mirror that only mirrors protected branches

Job #1468631524 failed for gitlab-foss@2885d70b:

Trace

Failures:
  1) Projects > Settings > Repository settings for maintainer remote mirror settings creates a push mirror that mirrors all branches
     Failure/Error: expect(project.remote_mirrors.first.only_protected_branches).to eq(false)
     NoMethodError:
       undefined method `only_protected_branches' for nil:NilClass
     # ./spec/features/projects/settings/repository_settings_spec.rb:151:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:423:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:414:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:410:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:50:in `with_raw_context'
     # ./spec/spec_helper.rb:410:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:268:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'
     # ./spec/support/flaky_tests.rb:27:in `block (2 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'
  2) Projects > Settings > Repository settings for maintainer remote mirror settings generates an SSH public key on submission
     Failure/Error: expect(page).to have_selector('[title="Copy SSH public key"]')
       expected to find css "[title=\"Copy SSH public key\"]" but there were no matches
     # ./spec/features/projects/settings/repository_settings_spec.rb:200:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:423:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:414:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:410:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:50:in `with_raw_context'
     # ./spec/spec_helper.rb:410:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:268:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <top (required)>'
     # ./spec/support/flaky_tests.rb:27:in `block (2 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <top (required)>'
Finished in 4 minutes 42.4 seconds (files took 32.2 seconds to load)

Steps to reproduce:

The below spec inconsistently fails. To reproduce this issue locally,

  1. Run FOSS_ONLY=1 bundle exec rspec ./spec/features/projects/settings/repository_settings_spec.rb.

I was able to get consistently success by adding binding.pry after filling the form and prior to the assertion

     it 'creates a push mirror that only mirrors protected branches', :js do
        find('#only_protected_branches').click

        expect(find('.js-mirror-protected-hidden', visible: false).value).to eq('1')

        fill_in 'url', with: 'ssh://user@localhost/project.git'
        select 'SSH public key', from: 'Authentication method'
        binding.pry
        select_direction
        
        Sidekiq::Testing.fake! do
          click_button 'Mirror repository'
        end

        project.reload

        expect(page).to have_content('Mirroring settings were successfully updated')
        binding.pry
        expect(project.remote_mirrors.first.only_protected_branches).to eq(true)
      end
Edited by Nao Hashizume