End to end tests are tests which require a DC/OS cluster to run against. Each test spins up at least one cluster, and has the choice of configuring this cluster as appropriate. For example, a test may require a cluster with a certain number of agents, or certain configuration options.
Tests must be run in a supported environment. See "Required Environment".
To create tests using clusters with custom configurations, first install the harness:
pip install --process-dependency-links git+https://github.com/mesosphere/dcos-e2e.git@master
Then, create a test, such as the following:
import subprocess
import uuid
from pathlib import Path
from dcos_e2e.backends import Docker
from dcos_e2e.cluster import Cluster
from passlib.hash import sha512_crypt
def test_oss_example():
oss_artifact = Path('/tmp/dcos_generate_config.sh')
with Cluster(cluster_backend=Docker()) as cluster:
cluster.install_dcos_from_path(
build_artifact=oss_artifact,
extra_config={'check_time': True},
)
(master, ) = cluster.masters
result = master.run(args=['test', '-f', path],
user=cluster.default_ssh_user)
print(result.stdout)
cluster.wait_for_dcos_oss()
cluster.run_integration_tests(pytest_command=['pytest', '-x', 'test_tls.py'])
try:
master.run(args=['test', '-f', '/no/file/here'],
user=cluster.default_ssh_user)
except subprocess.CalledProcessError:
print('No file exists')
def test_ee_example():
ee_artifact = Path('/tmp/dcos_generate_config.ee.sh')
superuser_username = str(uuid.uuid4())
superuser_password = str(uuid.uuid4())
# DC/OS Enterprise clusters require various configuration variables which
# are not allowed or required by DC/OS OSS clusters.
extra_config = {
'superuser_username': superuser_username,
'superuser_password_hash': sha512_crypt.hash(superuser_password),
'fault_domain_enabled': False,
}
with Cluster(cluster_backend=Docker()) as cluster:
cluster.install_dcos_from_path(
build_artifact=ee_artifact,
extra_config=extra_config,
)
cluster.wait_for_dcos_ee(
superuser_username=superuser_username,
superuser_password=superuser_password,
)
See API.md
for details on the API.
See CONTRIBUTING.md
for details on how to contribute to this repository.
See BACKENDS.md
for details on requirements for launching clusters with each backend.
Some backends leave junk around, especially when tests are cancelled.
See BACKENDS.md
for specifics of dealing with particular backends.