Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[match] fix match nuke not deleting decrypted files (#20776)
* Fix match nuke not deleting decrypted files * Fix hanging tests when having signed commits enabled * Fix match importer not deleting decrypted files * Fix match change_password not deleting decrypted files * Remove unused method parameter * Fix inconsistent logic * Fix match migrate not deleting decrypted files * Fix utils tests incorrectly asking for the password
- Loading branch information
Showing
11 changed files
with
194 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
describe Match do | ||
describe Match::ChangePassword do | ||
before do | ||
stub_const('ENV', { "MATCH_PASSWORD" => '2"QAHg@v(Qp{=*n^' }) | ||
end | ||
|
||
it "deletes decrypted files at the end", requires_security: true do | ||
git_url = "https://github.com/fastlane/fastlane/tree/master/certificates" | ||
values = { | ||
app_identifier: "tools.fastlane.app", | ||
type: "appstore", | ||
git_url: git_url, | ||
shallow_clone: true, | ||
username: "flapple@something.com" | ||
} | ||
|
||
config = FastlaneCore::Configuration.create(Match::Options.available_options, values) | ||
repo_dir = Dir.mktmpdir | ||
|
||
fake_storage = "fake_storage" | ||
expect(Match::Storage::GitStorage).to receive(:configure).with( | ||
git_url: git_url, | ||
shallow_clone: true, | ||
skip_docs: false, | ||
git_branch: "master", | ||
git_full_name: nil, | ||
git_user_email: nil, | ||
clone_branch_directly: false | ||
).and_return(fake_storage) | ||
|
||
allow(fake_storage).to receive(:download) | ||
allow(fake_storage).to receive(:working_directory).and_return(repo_dir) | ||
allow(fake_storage).to receive(:save_changes!) | ||
|
||
allow(Match::ChangePassword).to receive(:ensure_ui_interactive) | ||
allow(FastlaneCore::Helper).to receive(:ask_password).and_return("") | ||
|
||
expect(fake_storage).to receive(:clear_changes) | ||
|
||
Match::ChangePassword.update(params: config) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
describe Match do | ||
describe Match::Migrate do | ||
before do | ||
stub_const('ENV', { "MATCH_PASSWORD" => '2"QAHg@v(Qp{=*n^' }) | ||
end | ||
|
||
it "deletes decrypted files at the end", requires_security: true do | ||
git_url = "https://github.com/fastlane/fastlane/tree/master/certificates" | ||
values = { | ||
app_identifier: "tools.fastlane.app", | ||
type: "appstore", | ||
git_url: git_url, | ||
shallow_clone: true, | ||
username: "flapple@something.com" | ||
} | ||
|
||
config = FastlaneCore::Configuration.create(Match::Options.available_options, values) | ||
repo_dir = Dir.mktmpdir | ||
|
||
fake_google_cloud_storage = "fake_google_cloud_storage" | ||
expect(Match::Storage::GoogleCloudStorage).to receive(:configure).with( | ||
google_cloud_bucket_name: nil, | ||
google_cloud_keys_file: nil, | ||
google_cloud_project_id: nil | ||
).and_return(fake_google_cloud_storage) | ||
|
||
allow(fake_google_cloud_storage).to receive(:download) | ||
allow(fake_google_cloud_storage).to receive(:save_changes!) | ||
allow(fake_google_cloud_storage).to receive(:bucket_name).and_return("") | ||
|
||
fake_git_storage = "fake_git_storage" | ||
expect(Match::Storage::GitStorage).to receive(:configure).with( | ||
git_url: git_url, | ||
shallow_clone: true, | ||
git_branch: "master", | ||
clone_branch_directly: false | ||
).and_return(fake_git_storage) | ||
|
||
allow(fake_git_storage).to receive(:download) | ||
allow(fake_git_storage).to receive(:working_directory).and_return(repo_dir) | ||
|
||
spaceship = "spaceship" | ||
allow(spaceship).to receive(:team_id).and_return("team_id") | ||
allow(Match::SpaceshipEnsure).to receive(:new).and_return(spaceship) | ||
|
||
allow(UI).to receive(:input) | ||
|
||
expect(fake_google_cloud_storage).to receive(:clear_changes) | ||
expect(fake_git_storage).to receive(:clear_changes) | ||
|
||
Match::Migrate.new.migrate(config) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
describe Match do | ||
describe Match::Nuke do | ||
before do | ||
allow(Spaceship::ConnectAPI).to receive(:login).and_return(nil) | ||
allow(Spaceship::ConnectAPI).to receive(:client).and_return("client") | ||
allow(Spaceship::ConnectAPI.client).to receive(:in_house?).and_return(false) | ||
allow(Spaceship::ConnectAPI.client).to receive(:portal_team_id).and_return(nil) | ||
|
||
stub_const('ENV', { "MATCH_PASSWORD" => '2"QAHg@v(Qp{=*n^' }) | ||
end | ||
|
||
it "deletes decrypted files at the end", requires_security: true do | ||
git_url = "https://github.com/fastlane/fastlane/tree/master/certificates" | ||
values = { | ||
app_identifier: "tools.fastlane.app", | ||
type: "appstore", | ||
git_url: git_url, | ||
shallow_clone: true, | ||
username: "flapple@something.com" | ||
} | ||
|
||
config = FastlaneCore::Configuration.create(Match::Options.available_options, values) | ||
repo_dir = Dir.mktmpdir | ||
|
||
fake_storage = "fake_storage" | ||
expect(Match::Storage::GitStorage).to receive(:configure).with( | ||
git_url: git_url, | ||
shallow_clone: true, | ||
skip_docs: false, | ||
git_branch: "master", | ||
git_full_name: nil, | ||
git_user_email: nil, | ||
|
||
git_private_key: nil, | ||
git_basic_authorization: nil, | ||
git_bearer_authorization: nil, | ||
|
||
clone_branch_directly: false, | ||
google_cloud_bucket_name: "", | ||
google_cloud_keys_file: "", | ||
google_cloud_project_id: "", | ||
s3_region: "", | ||
s3_access_key: "", | ||
s3_secret_access_key: "", | ||
s3_bucket: "", | ||
s3_object_prefix: "", | ||
gitlab_project: nil, | ||
team_id: nil | ||
).and_return(fake_storage) | ||
|
||
allow(fake_storage).to receive(:download) | ||
allow(fake_storage).to receive(:working_directory).and_return(repo_dir) | ||
|
||
nuke = Match::Nuke.new | ||
|
||
allow(nuke).to receive(:prepare_list) | ||
allow(nuke).to receive(:filter_by_cert) | ||
allow(nuke).to receive(:print_tables) | ||
|
||
allow(nuke).to receive(:certs).and_return([]) | ||
allow(nuke).to receive(:profiles).and_return([]) | ||
allow(nuke).to receive(:files).and_return([]) | ||
|
||
expect(fake_storage).to receive(:clear_changes) | ||
|
||
nuke.run(config, type: config[:type]) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters