Skip to content

Commit

Permalink
[fastlane_core] strip upload param env before checking (#16783)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Holtz committed Jul 7, 2020
1 parent f2e2f8d commit b8dd142
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fastlane_core/lib/fastlane_core/itunes_transporter.rb
Expand Up @@ -155,7 +155,7 @@ def additional_upload_parameters
# It became crucial after WWDC 2020 as it leaded to "Broken pipe (Write failed)" exception
# More information https://github.com/fastlane/fastlane/issues/16749
env_deliver_additional_params = ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"]
if env_deliver_additional_params.to_s.empty?
if env_deliver_additional_params.to_s.strip.empty?
return nil
end

Expand Down
44 changes: 44 additions & 0 deletions fastlane_core/spec/itunes_transporter_spec.rb
Expand Up @@ -216,6 +216,17 @@ def xcrun_download_command(provider_short_name = nil)
after(:each) { ENV.delete("DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS") }
end

describe "upload command generation with DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS set to empty string" do
before(:each) { ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = " " }

it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new(email, password)
expect(transporter.upload('my.app.id', '/tmp')).to eq(java_upload_command)
end

after(:each) { ENV.delete("DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS") }
end

describe "download command generation" do
it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new(email, password)
Expand Down Expand Up @@ -379,6 +390,17 @@ def xcrun_download_command(provider_short_name = nil)
after(:each) { ENV.delete("DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS") }
end

describe "upload command generation with DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS set to empty string" do
before(:each) { ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = " " }

it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new(email, password)
expect(transporter.upload('my.app.id', '/tmp')).to eq(shell_upload_command)
end

after(:each) { ENV.delete("DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS") }
end

describe "download command generation" do
it 'generates a call to the shell script' do
transporter = FastlaneCore::ItunesTransporter.new(email, password, false)
Expand Down Expand Up @@ -420,6 +442,17 @@ def xcrun_download_command(provider_short_name = nil)
after(:each) { ENV.delete("DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS") }
end

describe "upload command generation with DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS set with empty string" do
before(:each) { ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = " " }

it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new(email, password)
expect(transporter.upload('my.app.id', '/tmp')).to eq(java_upload_command_9)
end

after(:each) { ENV.delete("DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS") }
end

describe "download command generation" do
it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new(email, password, false)
Expand Down Expand Up @@ -454,6 +487,17 @@ def xcrun_download_command(provider_short_name = nil)
after(:each) { ENV.delete("DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS") }
end

describe "upload command generation with DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS set with empty string" do
before(:each) { ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = " " }

it 'generates a call to java directly' do
transporter = FastlaneCore::ItunesTransporter.new(email, password)
expect(transporter.upload('my.app.id', '/tmp')).to eq(xcrun_upload_command)
end

after(:each) { ENV.delete("DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS") }
end

describe "download command generation" do
it 'generates a call to xcrun iTMSTransporter' do
transporter = FastlaneCore::ItunesTransporter.new(email, password, false)
Expand Down

0 comments on commit b8dd142

Please sign in to comment.