Skip to content

Commit

Permalink
chore: remove auto renewal test
Browse files Browse the repository at this point in the history
  • Loading branch information
nekrich committed Jan 22, 2024
1 parent acc6e8d commit 83173f3
Showing 1 changed file with 0 additions and 89 deletions.
89 changes: 0 additions & 89 deletions match/spec/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,95 +265,6 @@
# Rely on expectations defined above.
end

it "renews an outdated certificate", requires_security: true do
# GIVEN

# Downloaded and decrypted storage location.
repo_dir = "./match/spec/fixtures/invalid"
# Invalid cert and key
stored_invalid_cert_path = "#{repo_dir}/certs/distribution/F7P4EE896K.cer"
stored_invalid_key_path = "#{repo_dir}/certs/distribution/F7P4EE896K.p12"

# Valid cert and key
new_stored_valid_cert_path = "./match/spec/fixtures/valid/certs/distribution/E7P4EE896K.cer"
new_stored_valid_key_path = "./match/spec/fixtures/valid/certs/distribution/E7P4EE896K.p12"

# match options
match_test_options = {
skip_provisioning_profiles: true # We test certificate renewal, not profile.
}
match_config = create_match_config_with_git_storage(extra_values: match_test_options)

fake_cache = create_fake_cache

# EXPECTATIONS

# Storage
fake_storage = create_fake_storage(match_config: match_config, repo_dir: repo_dir)
begin # Ensure old certificates are removed from the storage and new are added.
expect(fake_storage).to receive(:save_changes!).with(
files_to_commit: [
new_stored_valid_cert_path,
new_stored_valid_key_path # this is important, as a cert consists out of 2 files
],
files_to_delete: [
stored_invalid_cert_path,
stored_invalid_key_path
]
)
end

# Encryption
fake_encryption = create_fake_encryption(storage: fake_storage)
# Ensure new files are encrypted.
expect(fake_encryption).to receive(:encrypt_files).and_return(nil)

# Certificate generator
# Ensure a new certificate is generated.
expect(Match::Generator).to receive(:generate_certificate).with(match_config, :distribution, fake_storage.working_directory, specific_cert_type: nil).and_return(new_stored_valid_cert_path)

# Spaceship ensure helper
spaceship_ensure = create_fake_spaceship_ensure
begin # Ensure match checks validity of the new certificate.
profile_type = Sigh.profile_type_for_distribution_type(
platform: match_config[:platform],
distribution_type: match_config[:type]
)

certificates_exists_params = {
username: match_config[:username],
certificate_ids: ['E7P4EE896K'],
cached_certificates: fake_cache.certificates,
platform: match_config[:platform],
profile_type: profile_type
}
expect(spaceship_ensure).to receive(:certificates_exists).with(certificates_exists_params).and_return(true)
end

# Utils
# Ensure match validates stored certificate and make it invalid for the current test suite.
expect(Match::Utils).to receive(:is_cert_valid?).with(stored_invalid_cert_path).and_return(false)

# File system
begin # Ensure old certificates are removed from the file system.
expect(File).to receive(:delete).with(stored_invalid_cert_path).and_return(nil)
expect(File).to receive(:delete).with(stored_invalid_key_path).and_return(nil)
end

# Extra
begin # Ensure profiles are not created, not installed, and not validated.
expect(Match::Generator).not_to receive(:generate_provisioning_profile)
expect(FastlaneCore::ProvisioningProfile).not_to receive(:install)
expect(spaceship_ensure).not_to receive(:profile_exists)
end

# WHEN
Match::Runner.new.run(match_config)

# THEN
# Rely on expectations defined above.
end

it "skips provisioning profiles when skip_provisioning_profiles set to true", requires_security: true do
git_url = "https://github.com/fastlane/fastlane/tree/master/certificates"
values = {
Expand Down

0 comments on commit 83173f3

Please sign in to comment.