Skip to content

Commit a73fcd8

Browse files
committed
(GH-540) Fix bolt upload failures
Prior to this commit we were seeing a lot of test failures when bolt was trying to upload test files to the remote host. These files were required to setup the env for the acceptance tests. This commit fixes the issue by altering the parameters passed to bolt_upload_file. In addition some common code has been refactored in to spec_helper_acceptance_local to avoid duplication and drift.
1 parent 4c339f4 commit a73fcd8

File tree

6 files changed

+17
-18
lines changed

6 files changed

+17
-18
lines changed

spec/acceptance/clone_repo_spec.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@
22

33
require 'spec_helper_acceptance'
44

5-
tmpdir = '/tmp/vcsrepo'
6-
75
describe 'clones a remote repo' do
86
before(:all) do
9-
my_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
10-
run_shell("rm -rf #{tmpdir}")
11-
bolt_upload_file("#{my_root}/acceptance/files", tmpdir, 'create_git_repo.sh')
12-
run_shell("cd #{tmpdir} && ./create_git_repo.sh")
7+
create_repo
138
end
149

1510
after(:all) do

spec/acceptance/create_repo_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
require 'spec_helper_acceptance'
44

5-
tmpdir = '/tmp/vcsrepo'
6-
75
describe 'create a repo' do
86
context 'with without a source' do
97
pp = <<-MANIFEST

spec/acceptance/multiple_remotes_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
require 'spec_helper_acceptance'
44

5-
tmpdir = '/tmp/vcsrepo'
6-
75
describe 'clones a remote repo', unless: only_supports_weak_encryption do
86
before(:all) do
97
File.expand_path(File.join(File.dirname(__FILE__), '..'))

spec/acceptance/remove_repo_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
require 'spec_helper_acceptance'
44

5-
tmpdir = '/tmp/vcsrepo'
6-
75
describe 'remove a repo' do
86
pp = <<-MANIFEST
97
vcsrepo { "#{tmpdir}/testrepo_deleted":

spec/acceptance/revision_spec.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@
22

33
require 'spec_helper_acceptance'
44

5-
tmpdir = '/tmp/vcsrepo'
6-
75
describe 'changing revision' do
86
before(:all) do
9-
# Create testrepo.git
10-
my_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
11-
bolt_upload_file("#{my_root}/acceptance/files", tmpdir, 'create_git_repo.sh')
12-
run_shell("cd #{tmpdir} && ./create_git_repo.sh")
7+
create_repo
138

149
# Configure testrepo.git as upstream of testrepo
1510
pp = <<-MANIFEST

spec/spec_helper_acceptance_local.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ class LitmusHelper
77
include PuppetLitmus
88
end
99

10+
def tmpdir
11+
'/tmp/vcsrepo'
12+
end
13+
14+
def project_root
15+
File.expand_path(File.join(File.dirname(__FILE__)))
16+
end
17+
18+
def create_repo
19+
LitmusHelper.instance.run_shell("rm -rf #{tmpdir}")
20+
LitmusHelper.instance.run_shell("mkdir -p #{tmpdir}")
21+
LitmusHelper.instance.bolt_upload_file("#{project_root}/acceptance/files/create_git_repo.sh", "#{tmpdir}/create_git_repo.sh")
22+
LitmusHelper.instance.run_shell("cd #{tmpdir} && ./create_git_repo.sh")
23+
end
24+
1025
RSpec.configure do |c|
1126
# Readable test descriptions
1227
c.formatter = :documentation

0 commit comments

Comments
 (0)