Commit d4274b66 authored by Mark Lapierre's avatar Mark Lapierre Committed by Dan Davison

Delete .netrc after each test

This avoids order-dependent failures that occur when a test adds a
user to .netrc that is different from the default runtime test user.

See also https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/670
parent a7b9628b
...@@ -32,7 +32,7 @@ module QA ...@@ -32,7 +32,7 @@ module QA
end end
end end
it 'allows a project to be created via the CLI with a different default branch name', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1019', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/295305', type: :flaky } do it 'allows a project to be created via the CLI with a different default branch name', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1019' do
project_name = "default-branch-name-via-cli-#{SecureRandom.hex(8)}" project_name = "default-branch-name-via-cli-#{SecureRandom.hex(8)}"
group = Resource::Group.fabricate_via_api! group = Resource::Group.fabricate_via_api!
......
...@@ -28,13 +28,6 @@ module QA ...@@ -28,13 +28,6 @@ module QA
end end
end end
after do
# Delete the .netrc file created during this test so that subsequent tests don't try to use the logins
Git::Repository.perform do |repository|
repository.delete_netrc
end
end
it 'download archives of each user project then check they are different', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/427' do it 'download archives of each user project then check they are different', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/427' do
archive_checksums = {} archive_checksums = {}
......
...@@ -27,6 +27,11 @@ RSpec.configure do |config| ...@@ -27,6 +27,11 @@ RSpec.configure do |config|
QA::Runtime::Logger.debug("\nStarting test: #{example.full_description}\n") QA::Runtime::Logger.debug("\nStarting test: #{example.full_description}\n")
end end
config.after do
# If a .netrc file was created during the test, delete it so that subsequent tests don't try to use the same logins
QA::Git::Repository.new.delete_netrc
end
config.after(:context) do config.after(:context) do
if !QA::Runtime::Browser.blank_page? && QA::Page::Main::Menu.perform(&:signed_in?) if !QA::Runtime::Browser.blank_page? && QA::Page::Main::Menu.perform(&:signed_in?)
QA::Page::Main::Menu.perform(&:sign_out) QA::Page::Main::Menu.perform(&:sign_out)
......
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