summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Savineau <dsavinea@redhat.com>2019-02-04 10:53:50 -0500
committerDimitri Savineau <dsavinea@redhat.com>2019-02-04 10:53:50 -0500
commit4f44cfdc1b0abedbcdd90149a8b527d5b7e07bd9 (patch)
tree0654cd610caeef9cd0c5ae0ff0781cc16b1136b9
parent3f048cf55c9e11b08a7b4d69beb1e56c14323c33 (diff)
molecule: Use host.sudo() instead of sudo command
Change-Id: Ifecd5d17f96023638e70a049aefaea82a9069e2e
-rw-r--r--molecule/default/tests/test_docker.py9
-rw-r--r--molecule/default/tests/test_docker_distribution.py9
2 files changed, 10 insertions, 8 deletions
diff --git a/molecule/default/tests/test_docker.py b/molecule/default/tests/test_docker.py
index de4665c..7032d22 100644
--- a/molecule/default/tests/test_docker.py
+++ b/molecule/default/tests/test_docker.py
@@ -51,7 +51,8 @@ def test_docker_socket(host):
def test_docker_info(host):
- cmd = host.run('sudo docker info')
- assert cmd.rc == 0
- assert 'Storage Driver: vfs' in cmd.stdout
- assert ' 127.0.0.1:5000' in cmd.stdout
+ with host.sudo():
+ cmd = host.run('docker info')
+ assert cmd.rc == 0
+ assert 'Storage Driver: vfs' in cmd.stdout
+ assert ' 127.0.0.1:5000' in cmd.stdout
diff --git a/molecule/default/tests/test_docker_distribution.py b/molecule/default/tests/test_docker_distribution.py
index a652dec..7b5179b 100644
--- a/molecule/default/tests/test_docker_distribution.py
+++ b/molecule/default/tests/test_docker_distribution.py
@@ -33,10 +33,11 @@ def test_docker_distribution_socket(host):
def test_docker_distribution_pull_image(host):
- cmd = host.run('sudo docker pull 127.0.0.1:5000/amd64/busybox:latest')
- assert cmd.rc == 0
- assert 'Pull complete' in cmd.stdout
- assert '127.0.0.1:5000/amd64/busybox:latest' in cmd.stdout
+ with host.sudo():
+ cmd = host.run('docker pull 127.0.0.1:5000/amd64/busybox:latest')
+ assert cmd.rc == 0
+ assert 'Pull complete' in cmd.stdout
+ assert '127.0.0.1:5000/amd64/busybox:latest' in cmd.stdout
def test_docker_distribution_catalog(host):