
There is quite a bit going on in this commit. Here is a high level description of all of the changes: * Improved the README to include information for running the integrations tests now that we have subcommand management support. * Change the clean script to also delete the build directory. * Removed requirement on the DCOS_PATH environment variable. We now assume the DCOS CLI installation directory based on the location of the dcos cli binary * Adds support for installing subcommand from python wheels. The packages are install under the 'subcommands' directory. * Extended the `dcos help` to look into the 'subcommands' directory for the excutables that extend the cli. * Fix the root `dcos` executable to not use the DCOS_PATH environment variable to discover subcommand. It now discovers subcommand based on the location of the root (`dcos`) executable. * Adds `dcos subcommand` for managing the installation, listing and the removal of subcommands. * Adds dependencies on pkginfo and virtualenv. We need pkginfo to query information about the package. We need virtualenv to create virtual environment for each subcommand installed.
64 lines
1.8 KiB
Python
64 lines
1.8 KiB
Python
import os
|
|
|
|
from dcos.api import util
|
|
|
|
from common import exec_command
|
|
|
|
|
|
def test_help():
|
|
returncode, stdout, stderr = exec_command(['dcos', 'help', '--help'])
|
|
|
|
assert returncode == 0
|
|
assert stdout == b"""Display usage information
|
|
|
|
Usage:
|
|
dcos help
|
|
dcos help --all
|
|
dcos help info
|
|
|
|
Options:
|
|
--help Show this screen
|
|
--version Show version
|
|
--all Prints all available commands to the standard output
|
|
"""
|
|
assert stderr == b''
|
|
|
|
|
|
def test_info():
|
|
returncode, stdout, stderr = exec_command(['dcos', 'help', 'info'])
|
|
|
|
assert returncode == 0
|
|
assert stdout == b'Display usage information\n'
|
|
assert stderr == b''
|
|
|
|
|
|
def test_version():
|
|
returncode, stdout, stderr = exec_command(['dcos', 'help', '--version'])
|
|
|
|
assert returncode == 0
|
|
assert stdout == b'dcos-help version 0.1.0\n'
|
|
assert stderr == b''
|
|
|
|
|
|
def test_list_all():
|
|
dcos_path = os.path.dirname(os.path.dirname(util.which('dcos')))
|
|
returncode, stdout, stderr = exec_command(['dcos', 'help', '--all'])
|
|
|
|
assert returncode == 0
|
|
assert stdout == """Command line utility for \
|
|
the Mesosphere DataCenter Operating System (DCOS). The Mesosphere DCOS is \
|
|
a distributed operating system built around Apache Mesos. This utility \
|
|
provides tools for easy management of a DCOS installation.
|
|
|
|
Available DCOS commands in '{}':
|
|
|
|
\tconfig \tGet and set DCOS command line options
|
|
\thelp \tDisplay usage information
|
|
\tmarathon \tDeploy and manage applications on the DCOS
|
|
\tpackage \tInstall and manage DCOS software packages
|
|
\tsubcommand \tInstall and manage DCOS CLI Subcommands
|
|
|
|
Get detailed command description with 'dcos <command> --help'.
|
|
""".format(dcos_path).encode('utf-8')
|
|
assert stderr == b''
|