def run_integration_tests(
self,
pytest_command: List[str],
env: Optional[Dict] = None,
log_output_live: bool = False,
) -> subprocess.CompletedProcess:
"""
Run integration tests on a random master node.
Args:
pytest_command: The ``pytest`` command to run on the node.
env: Environment variables to be set on the node before running
the `pytest_command`. On enterprise
clusters, `DCOS_LOGIN_UNAME` and `DCOS_LOGIN_PW` must be set.
log_output_live: If `True`, log output of the `pytest_command`
live. If `True`, stderr is merged into stdout in the return
value.
Returns:
The result of the ``pytest`` command.
Raises:
``subprocess.CalledProcessError`` if the ``pytest`` command fails.
"""
args = [
'source',
'/opt/mesosphere/environment.export',
'&&',
'cd',
'/opt/mesosphere/active/dcos-integration-test/',
'&&',
]
env = env or {}
def ip_addresses(nodes: Iterable[Node]) -> str:
return ','.join(map(lambda node: str(node.ip_address), nodes))
environment_variables = {
'MASTER_HOSTS': ip_addresses(self.masters),
'SLAVE_HOSTS': ip_addresses(self.agents),
'PUBLIC_SLAVE_HOSTS': ip_addresses(self.public_agents),
**env,
}
args += pytest_command
# Tests are run on a random master node.
test_host = next(iter(self.masters))
return test_host.run(
args=args,
user=self.default_ssh_user,
log_output_live=log_output_live,
env=environment_variables,
)
评论列表
文章目录