enable using kitchen-salt on ec2

These changes are needed to run the test suite on ec2 using sudo.
This commit is contained in:
Daniel Wallace 2017-12-20 09:21:23 -07:00
parent 54a33c0e1d
commit 23bd38ad66
No known key found for this signature in database
GPG key ID: 5FA5E5544F010D48
3 changed files with 8 additions and 5 deletions

View file

@ -24,7 +24,7 @@ transport:
name: sftp
<% end %>
sudo: false
sudo: true
provisioner:
name: salt_solo
salt_install: bootstrap
@ -184,10 +184,9 @@ suites:
verifier:
name: shell
remote_exec: true
sudo: false
live_stream: {}
<% if ENV['TESTOPTS'].nil? %>
command: '$(kitchen) /tmp/kitchen/testing/tests/runtests.py --run-destructive --sysinfo --transport=zeromq --output-columns=80 --ssh --coverage-xml=/tmp/coverage.xml --xml=/tmp/xml-unittests-output'
command: 'sudo -E $(kitchen) /tmp/kitchen/testing/tests/runtests.py -v --run-destructive --sysinfo --transport=zeromq --output-columns=80 --ssh --coverage-xml=/tmp/coverage.xml --xml=/tmp/xml-unittests-output'
<% else %>
command: '$(kitchen) /tmp/kitchen/testing/tests/runtests.py --run-destructive --output-columns 80 <%= ENV["TESTOPTS"] %>'
command: 'sudo -E $(kitchen) /tmp/kitchen/testing/tests/runtests.py -v --run-destructive --output-columns 80 <%= ENV["TESTOPTS"] %>'
<% end %>

View file

@ -22,3 +22,7 @@ group :windows do
gem 'winrm', '~>2.0'
gem 'winrm-fs', '~>1.0'
end
group :ec2 do
gem 'kitchen-ec2'
end

View file

@ -131,5 +131,5 @@ class RunnerReturnsTest(ShellCase):
'jid': jid,
'return': {'args': ['foo'], 'kwargs': {'bar': 'hello world!'}},
'success': True,
'user': RUNTIME_VARS.RUNNING_TESTS_USER}
'user': RUNTIME_VARS.RUNNING_TESTS_USER if 'SUDO_USER' not in os.environ else 'root'}
)