Skip to content

Commit

Permalink
Add a test against infinite prompt during cluster setup
Browse files Browse the repository at this point in the history
Prior to 1254a2f and when running
"dcos cluster setup" command as non-interactive, the process would run
and ask for user input forever.

This adds an integration test which fails if the process doesn't exit by
itself with an error within 15 seconds.

https://jira.mesosphere.com/browse/DCOS-15590
  • Loading branch information
bamarni committed Aug 16, 2017
1 parent c9b5bb8 commit aa544e0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cli/tests/integrations/test_cluster.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import subprocess

from .helpers.common import assert_command, exec_command

Expand Down Expand Up @@ -43,3 +44,24 @@ def test_rename():

# rename back to original name
assert_command(['dcos', 'cluster', 'rename', new_name, name])


def test_setup_noninteractive():
"""
Run "dcos cluster setup" command as non-interactive with a 30 sec timeout.
This makes sure the process doesn't prompt for input forever (DCOS-15590).
"""

try:
returncode, stdout, _ = exec_command(
['dcos',
'cluster',
'setup',
'https://dcos.snakeoil.mesosphere.com'],
timeout=30,
stdin=subprocess.DEVNULL)
except subprocess.TimeoutExpired:
assert False, 'timed out waiting for process to exit'

assert returncode == 1
assert b"'' is not a valid response" in stdout

0 comments on commit aa544e0

Please sign in to comment.