Commit b982a4bc authored by Kerri Miller's avatar Kerri Miller

Merge branch 'jswain_bump_glex' into 'master'

Bump gitlab-experiment to 0.5.2 [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!58428
parents f0a518b0 41458bbd
...@@ -488,7 +488,7 @@ gem 'flipper', '~> 0.17.1' ...@@ -488,7 +488,7 @@ gem 'flipper', '~> 0.17.1'
gem 'flipper-active_record', '~> 0.17.1' gem 'flipper-active_record', '~> 0.17.1'
gem 'flipper-active_support_cache_store', '~> 0.17.1' gem 'flipper-active_support_cache_store', '~> 0.17.1'
gem 'unleash', '~> 0.1.5' gem 'unleash', '~> 0.1.5'
gem 'gitlab-experiment', '~> 0.5.1' gem 'gitlab-experiment', '~> 0.5.2'
# Structured logging # Structured logging
gem 'lograge', '~> 0.5' gem 'lograge', '~> 0.5'
......
...@@ -443,7 +443,7 @@ GEM ...@@ -443,7 +443,7 @@ GEM
numerizer (~> 0.2) numerizer (~> 0.2)
gitlab-dangerfiles (1.1.0) gitlab-dangerfiles (1.1.0)
danger-gitlab danger-gitlab
gitlab-experiment (0.5.1) gitlab-experiment (0.5.2)
activesupport (>= 3.0) activesupport (>= 3.0)
scientist (~> 1.6, >= 1.6.0) scientist (~> 1.6, >= 1.6.0)
gitlab-fog-azure-rm (1.0.1) gitlab-fog-azure-rm (1.0.1)
...@@ -1424,7 +1424,7 @@ DEPENDENCIES ...@@ -1424,7 +1424,7 @@ DEPENDENCIES
github-markup (~> 1.7.0) github-markup (~> 1.7.0)
gitlab-chronic (~> 0.10.5) gitlab-chronic (~> 0.10.5)
gitlab-dangerfiles (~> 1.1.0) gitlab-dangerfiles (~> 1.1.0)
gitlab-experiment (~> 0.5.1) gitlab-experiment (~> 0.5.2)
gitlab-fog-azure-rm (~> 1.0.1) gitlab-fog-azure-rm (~> 1.0.1)
gitlab-fog-google (~> 1.13) gitlab-fog-google (~> 1.13)
gitlab-labkit (~> 0.16.2) gitlab-labkit (~> 0.16.2)
......
...@@ -256,7 +256,7 @@ RSpec.describe Registrations::GroupsController do ...@@ -256,7 +256,7 @@ RSpec.describe Registrations::GroupsController do
it 'tracks experiment as expected', :experiment do it 'tracks experiment as expected', :experiment do
expect(experiment(:registrations_group_invite)) expect(experiment(:registrations_group_invite))
.to track(:created, { property: group.id.to_s }) .to track(:created, { property: group.id.to_s })
.on_any_instance .on_next_instance
.with_context(actor: user) .with_context(actor: user)
subject subject
...@@ -322,7 +322,7 @@ RSpec.describe Registrations::GroupsController do ...@@ -322,7 +322,7 @@ RSpec.describe Registrations::GroupsController do
expect(experiment(:registrations_group_invite)) expect(experiment(:registrations_group_invite))
.to track(:created, { property: group.id.to_s }) .to track(:created, { property: group.id.to_s })
.on_any_instance .on_next_instance
.with_context(actor: user) .with_context(actor: user)
subject subject
...@@ -358,7 +358,7 @@ RSpec.describe Registrations::GroupsController do ...@@ -358,7 +358,7 @@ RSpec.describe Registrations::GroupsController do
end end
expect(experiment(:registrations_group_invite)) expect(experiment(:registrations_group_invite))
.to track(:created, { property: group.id.to_s }) .to track(:created, { property: group.id.to_s })
.on_any_instance .on_next_instance
.with_context(actor: user) .with_context(actor: user)
subject subject
......
...@@ -82,7 +82,7 @@ RSpec.describe Registrations::ProjectsController do ...@@ -82,7 +82,7 @@ RSpec.describe Registrations::ProjectsController do
it 'tracks the registrations_group_invite experiment as expected', :experiment do it 'tracks the registrations_group_invite experiment as expected', :experiment do
expect(experiment(:registrations_group_invite)) expect(experiment(:registrations_group_invite))
.to track(:signup_successful, { property: namespace.id.to_s }) .to track(:signup_successful, { property: namespace.id.to_s })
.on_any_instance .on_next_instance
.with_context(actor: user) .with_context(actor: user)
subject subject
......
...@@ -82,7 +82,7 @@ RSpec.describe 'view group invites' do ...@@ -82,7 +82,7 @@ RSpec.describe 'view group invites' do
it 'tracks experiment as expected', :experiment do it 'tracks experiment as expected', :experiment do
expect(experiment(:registrations_group_invite)) expect(experiment(:registrations_group_invite))
.to track(:invites_sent, { property: group.id.to_s, value: valid_emails.size }) .to track(:invites_sent, { property: group.id.to_s, value: valid_emails.size })
.on_any_instance .on_next_instance
.with_context(actor: user) .with_context(actor: user)
post_request post_request
......
...@@ -74,8 +74,9 @@ RSpec.describe Projects::IssuesController do ...@@ -74,8 +74,9 @@ RSpec.describe Projects::IssuesController do
end end
it 'assigns the candidate experience and tracks the event' do it 'assigns the candidate experience and tracks the event' do
expect(experiment(:null_hypothesis)).to track('index').on_any_instance.for(:candidate) expect(experiment(:null_hypothesis)).to track('index').for(:candidate)
.with_context(project: project) .with_context(project: project)
.on_next_instance
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
end end
...@@ -218,10 +219,10 @@ RSpec.describe Projects::IssuesController do ...@@ -218,10 +219,10 @@ RSpec.describe Projects::IssuesController do
end end
it 'assigns the candidate experience and tracks the event' do it 'assigns the candidate experience and tracks the event' do
expect(experiment(:invite_member_link)).to track(:view, property: project.root_ancestor.id.to_s) expect(experiment(:invite_members_in_comment)).to track(:view, property: project.root_ancestor.id.to_s)
.on_any_instance
.for(:invite_member_link) .for(:invite_member_link)
.with_context(namespace: project.root_ancestor) .with_context(namespace: project.root_ancestor)
.on_next_instance
get :show, params: { namespace_id: project.namespace, project_id: project, id: issue.iid } get :show, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
end end
...@@ -229,7 +230,7 @@ RSpec.describe Projects::IssuesController do ...@@ -229,7 +230,7 @@ RSpec.describe Projects::IssuesController do
context 'when user can not invite' do context 'when user can not invite' do
it 'does not track the event' do it 'does not track the event' do
expect(experiment(:invite_member_link)).not_to track(:view) expect(experiment(:invite_members_in_comment)).not_to track(:view)
get :show, params: { namespace_id: project.namespace, project_id: project, id: issue.iid } get :show, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
end end
......
...@@ -48,10 +48,10 @@ RSpec.describe Projects::MergeRequestsController do ...@@ -48,10 +48,10 @@ RSpec.describe Projects::MergeRequestsController do
end end
it 'assigns the candidate experience and tracks the event' do it 'assigns the candidate experience and tracks the event' do
expect(experiment(:invite_member_link)).to track(:view, property: project.root_ancestor.id.to_s) expect(experiment(:invite_members_in_comment)).to track(:view, property: project.root_ancestor.id.to_s)
.on_any_instance
.for(:invite_member_link) .for(:invite_member_link)
.with_context(namespace: project.root_ancestor) .with_context(namespace: project.root_ancestor)
.on_next_instance
go go
end end
...@@ -59,7 +59,7 @@ RSpec.describe Projects::MergeRequestsController do ...@@ -59,7 +59,7 @@ RSpec.describe Projects::MergeRequestsController do
context 'when user can not invite' do context 'when user can not invite' do
it 'does not track the event' do it 'does not track the event' do
expect(experiment(:invite_member_link)).not_to track(:view) expect(experiment(:invite_members_in_comment)).not_to track(:view)
go go
end end
......
...@@ -221,22 +221,16 @@ RSpec.describe ProjectsController do ...@@ -221,22 +221,16 @@ RSpec.describe ProjectsController do
allow(controller).to receive(:record_experiment_user) allow(controller).to receive(:record_experiment_user)
end end
context 'when user can push to default branch' do context 'when user can push to default branch', :experiment do
let(:user) { empty_project.owner } let(:user) { empty_project.owner }
it 'creates an "view_project_show" experiment tracking event', :snowplow do it 'creates an "view_project_show" experiment tracking event' do
allow_next_instance_of(ApplicationExperiment) do |e| expect(experiment(:empty_repo_upload)).to track(
allow(e).to receive(:should_track?).and_return(true) :view_project_show,
end property: 'empty'
).on_next_instance
get :show, params: { namespace_id: empty_project.namespace, id: empty_project } get :show, params: { namespace_id: empty_project.namespace, id: empty_project }
expect_snowplow_event(
category: 'empty_repo_upload',
action: 'view_project_show',
property: 'empty',
context: [{ schema: 'iglu:com.gitlab/gitlab_experiment/jsonschema/1-0-0', data: anything }]
)
end end
end end
...@@ -449,7 +443,7 @@ RSpec.describe ProjectsController do ...@@ -449,7 +443,7 @@ RSpec.describe ProjectsController do
:created, :created,
property: 'blank', property: 'blank',
value: 1 value: 1
).on_any_instance.with_context(actor: user) ).with_context(actor: user).on_next_instance
post :create, params: { project: project_params } post :create, params: { project: project_params }
end end
......
...@@ -7,10 +7,6 @@ RSpec.describe NewProjectReadmeExperiment, :experiment do ...@@ -7,10 +7,6 @@ RSpec.describe NewProjectReadmeExperiment, :experiment do
let(:actor) { User.new(id: 42, created_at: Time.current) } let(:actor) { User.new(id: 42, created_at: Time.current) }
before do
stub_experiments(new_project_readme: :control)
end
describe "exclusions" do describe "exclusions" do
let(:threshold) { described_class::MAX_ACCOUNT_AGE } let(:threshold) { described_class::MAX_ACCOUNT_AGE }
......
...@@ -799,14 +799,14 @@ RSpec.describe Notify do ...@@ -799,14 +799,14 @@ RSpec.describe Notify do
is_expected.to have_link('Join now', href: invite_url(project_member.invite_token, invite_type: Members::InviteEmailExperiment::INVITE_TYPE)) is_expected.to have_link('Join now', href: invite_url(project_member.invite_token, invite_type: Members::InviteEmailExperiment::INVITE_TYPE))
end end
it 'contains invite link for the avatar', :experiment do it 'contains invite link for the avatar' do
stub_experiments('members/invite_email': :avatar) stub_experiments('members/invite_email': :avatar)
is_expected.not_to have_content('You are invited!') is_expected.not_to have_content('You are invited!')
is_expected.not_to have_body_text 'What is a GitLab' is_expected.not_to have_body_text 'What is a GitLab'
end end
it 'contains invite link for the avatar', :experiment do it 'contains invite link for the avatar' do
stub_experiments('members/invite_email': :permission_info) stub_experiments('members/invite_email': :permission_info)
is_expected.not_to have_content('You are invited!') is_expected.not_to have_content('You are invited!')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment