-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PRD] TCI/Assembla Handshake with SVN/P4 (#2080)
- Loading branch information
1 parent
e980c46
commit 8d728a9
Showing
14 changed files
with
487 additions
and
18 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
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,51 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe Travis::Vcs::Perforce::Clone, :sexp do | ||
let(:data) { payload_for(payload_name, :ruby, config: {}) } | ||
let(:sh) { Travis::Shell::Builder.new } | ||
let(:clone) { described_class.new(sh, Travis::Build::Data.new(data)) } | ||
|
||
describe '#apply' do | ||
let(:payload_name) { :perforce } | ||
let(:key_sexp) { [:cmd, "echo $(p4 info | grep 'Server address:' | cut -d ' ' -f 3- 2>/dev/null)=pubkey:privatekey > /tmp/p4ticket"] } | ||
let(:tickets_sexp) { [:export, ['P4TICKETS', '/tmp/p4ticket']] } | ||
let(:client_sexp) { [:cmd, 'p4 -v ssl.client.trust.name=1 client -S //depot/main -o | p4 -v ssl.client.trust.name=1 client -i'] } | ||
|
||
subject { sh.to_sexp } | ||
|
||
before { clone.apply } | ||
|
||
it { is_expected.to include_sexp([:export, ['P4USER', 'pubkey'], echo: true]) } | ||
it { is_expected.to include_sexp([:export, ['P4CHARSET', 'utf8']]) } | ||
it { is_expected.to include_sexp([:export, ['P4PORT', 'ssl:perforce.assembla.com']]) } | ||
it { is_expected.to include_sexp([:cmd, 'p4 trust -y']) } | ||
it { is_expected.to include_sexp(key_sexp) } | ||
it { is_expected.to include_sexp(tickets_sexp) } | ||
it { is_expected.to include_sexp(client_sexp) } | ||
it { is_expected.to include_sexp([:cmd, 'p4 -v ssl.client.trust.name=1 sync -p']) } | ||
it { is_expected.to include_sexp([:cd, 'tempdir', echo: true]) } | ||
it { is_expected.not_to include_sexp([:mkdir, '~/.ssh', recursive: true]) } | ||
|
||
context 'when repository is not from Assembla' do | ||
let(:payload_name) { :perforce_non_assembla } | ||
|
||
it { is_expected.to include_sexp([:export, ['P4USER', 'travisuser'], echo: true]) } | ||
it { is_expected.not_to include_sexp(key_sexp) } | ||
it { is_expected.to include_sexp([:export, ['P4PASSWD', 'mybuildtoken']]) } | ||
it { is_expected.not_to include_sexp(tickets_sexp) } | ||
end | ||
|
||
context 'when the job is a PR' do | ||
let(:payload_name) { :perforce_pull_request } | ||
|
||
it { is_expected.not_to include(client_sexp) } | ||
it { is_expected.to include_sexp(tickets_sexp) } | ||
it { is_expected.to include_sexp([:cmd, 'p4 -v ssl.client.trust.name=1 client -S //depot/main -o | p4 -v ssl.client.trust.name=1 client -i']) } | ||
it { is_expected.to include_sexp([:cmd, 'p4 -v ssl.client.trust.name=1 sync -p']) } | ||
it { is_expected.to include_sexp([:cmd, 'p4 -v ssl.client.trust.name=1 merge //depot/newfeature/... //depot/main/...']) } | ||
it { is_expected.to include_sexp([:cmd, 'p4 -v ssl.client.trust.name=1 resolve -am']) } | ||
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,26 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe Travis::Vcs::Perforce, :sexp do | ||
let(:data) { payload_for(:perforce, :ruby, config: {}) } | ||
let(:sh) { Travis::Shell::Builder.new } | ||
let(:perforce) { described_class.new(sh, Travis::Build::Data.new(data)) } | ||
|
||
describe '#checkout' do | ||
subject { sh.to_sexp } | ||
|
||
before { perforce.checkout } | ||
|
||
it { is_expected.to include_sexp([:export, ['P4USER', 'pubkey'], echo: true]) } | ||
it { is_expected.to include_sexp([:export, ['P4CHARSET', 'utf8']]) } | ||
it { is_expected.to include_sexp([:export, ['P4PORT', 'ssl:perforce.assembla.com']]) } | ||
it { is_expected.to include_sexp([:cmd, 'p4 trust -y']) } | ||
it { is_expected.to include_sexp([:cmd, "echo $(p4 info | grep 'Server address:' | cut -d ' ' -f 3- 2>/dev/null)=pubkey:privatekey > /tmp/p4ticket"]) } | ||
it { is_expected.to include_sexp([:export, ['P4TICKETS', '/tmp/p4ticket']]) } | ||
it { is_expected.to include_sexp([:cmd, 'p4 -v ssl.client.trust.name=1 client -S //depot/main -o | p4 -v ssl.client.trust.name=1 client -i']) } | ||
it { is_expected.to include_sexp([:cmd, 'p4 -v ssl.client.trust.name=1 sync -p']) } | ||
it { is_expected.to include_sexp([:cd, 'tempdir', echo: true]) } | ||
it { is_expected.not_to include_sexp([:mkdir, '~/.ssh', recursive: true]) } | ||
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,37 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe Travis::Vcs::Svn::Clone, :sexp do | ||
let(:data) { payload_for(payload_name, :ruby, config: {}) } | ||
let(:sh) { Travis::Shell::Builder.new } | ||
let(:clone) { described_class.new(sh, Travis::Build::Data.new(data)) } | ||
|
||
describe '#apply' do | ||
let(:assembla_checkout_sexp) { [:cmd, 'svn co svn+ssh://assembla.com/branches/main ruby-example', retry: true] } | ||
let(:update_sexp) { [:cmd, 'svn update -r 9500504'] } | ||
let(:payload_name) { :svn } | ||
|
||
subject { sh.to_sexp } | ||
|
||
before { clone.apply } | ||
|
||
it { is_expected.to include_sexp(assembla_checkout_sexp) } | ||
it { is_expected.to include_sexp(update_sexp) } | ||
|
||
context 'when repository is not from Assembla' do | ||
let(:payload_name) { :svn_non_assembla } | ||
|
||
it { is_expected.to include_sexp([:cmd, 'svn co /branches/main ruby-example', retry: true]) } | ||
it { is_expected.to include_sexp(update_sexp) } | ||
end | ||
|
||
context 'when the job is a PR' do | ||
let(:payload_name) { :svn_pull_request } | ||
|
||
it { is_expected.to include_sexp(assembla_checkout_sexp) } | ||
it { is_expected.not_to include(update_sexp) } | ||
it { is_expected.to include_sexp([:cmd, 'svn merge --non-interactive ^/branches/newfeature']) } | ||
end | ||
end | ||
end |
Oops, something went wrong.