예제 #1
0
        )
        value = result.stdout.strip().decode()
        return str(value)


@pytest.fixture()
def etcd_client(static_three_master_cluster: Cluster) -> EtcdClient:
    etcd_client = EtcdClient(static_three_master_cluster.masters)
    return etcd_client


@pytest.mark.skipif(
    only_changed(E2E_SAFE_DEFAULT + [
        # All packages safe except named packages
        'packages/*/**',
        '!packages/etcd/**',  # All packages safe except named packages
        # All e2e tests safe except this test
        'test-e2e/test_*',
        '!' + escape(trailing_path(__file__, 2)),
    ]),
    reason='Only safe files modified',
)
class TestEtcdBackup:
    def test_snapshot_backup_and_restore(
        self,
        static_three_master_cluster: Cluster,
        etcd_client: EtcdClient,
        tmp_path: Path,
        request: SubRequest,
        log_dir: Path,
    ) -> None:
예제 #2
0
    """
    The `FLAG` value exists in ZooKeeper at `znode` path.
    """
    try:
        value = zk.retry(zk.get, znode)
    except NoNodeError:
        return False
    return bool(value[0] == FLAG)


@pytest.mark.skipif(
    only_changed(E2E_SAFE_DEFAULT + [
        # All packages safe except named packages
        'packages/**',
        '!packages/*treeinfo.json',
        '!packages/{exhibitor,java}/**',
        # All e2e tests safe except this test
        'test-e2e/test_*',
        '!' + escape(trailing_path(__file__, 2)),
    ]),
    reason='Only safe files modified',
)
class TestZooKeeperBackup:
    """
    Within the context of DC/OS ZooKeeper can be backed up on a running
    cluster and a previous state can be restored.
    """
    def test_transaction_log_backup_and_restore(
        self,
        static_three_master_cluster: Cluster,
        zk_client: KazooClient,
예제 #3
0
        )
        yield cluster

        dump_cluster_journals(
            cluster=cluster,
            target_dir=log_dir / artifact_dir_format(request.node.name),
        )


@pytest.mark.skipif(
    only_changed(E2E_SAFE_DEFAULT + [
        # All packages safe except named packages
        'packages/**',
        '!packages/*treeinfo.json',
        '!packages/etcd/**',
        '!packages/calico/**',
        '!packages/python*/**',
        # All e2e tests safe except this test
        'test-e2e/test_*',
        '!' + escape(trailing_path(__file__, 2)),
    ]),
    reason='Only safe files modified',
)
def test_calico_disabled(docker_backend: Docker, artifact_path: Path,
                         request: SubRequest, log_dir: Path) -> None:
    with Cluster(
            cluster_backend=docker_backend,
            masters=1,
            agents=1,
            public_agents=1,
    ) as cluster:
예제 #4
0
    network = client.networks.create(
        name='dcos-e2e-network-{random}'.format(random=uuid.uuid4()),
        driver='bridge',
        ipam=docker.types.IPAMConfig(pool_configs=[ipam_pool]),
        attachable=False,
    )
    try:
        yield network
    finally:
        network.remove()


@pytest.mark.skipif(
    only_changed(E2E_SAFE_DEFAULT + [
        'packages/dcos-integration-test/**',
        # All e2e tests safe except this test
        'test-e2e/test_*',
        '!' + escape(trailing_path(__file__, 2)),
    ]),
    reason='Only safe files modified',
)
def test_replace_all_static(
    artifact_path: Path,
    docker_network_three_available_addresses: Network,
    tmp_path: Path,
    request: SubRequest,
    log_dir: Path,
) -> None:
    """
    In a cluster with an Exhibitor backend consisting of a static ZooKeeper
    ensemble, after removing one master, and then adding another master with
    the same IP address, the cluster will get to a healthy state. This is
예제 #5
0
    network = client.networks.create(
        name='dcos-e2e-network-{random}'.format(random=uuid.uuid4()),
        driver='bridge',
        ipam=docker.types.IPAMConfig(pool_configs=[ipam_pool]),
        attachable=False,
    )
    try:
        yield network
    finally:
        network.remove()


@pytest.mark.skipif(
    only_changed(E2E_SAFE_DEFAULT + [
        # All e2e tests safe except this test
        'test-e2e/test_*',
        '!' + escape(trailing_path(__file__, 2)),
    ]),
    reason='Only safe files modified',
)
def test_replace_all_static(
    artifact_path: Path,
    docker_network_three_available_addresses: Network,
    tmp_path: Path,
    request: SubRequest,
    log_dir: Path,
) -> None:
    """
    In a cluster with an Exhibitor backend consisting of a static ZooKeeper
    ensemble, after removing one master, and then adding another master with
    the same IP address, the cluster will get to a healthy state. This is
예제 #6
0
import etcd3.watch
import pytest
import requests
from _pytest.fixtures import SubRequest
from cluster_helpers import wait_for_dcos_oss
from conditional import E2E_SAFE_DEFAULT, escape, only_changed, trailing_path
from dcos_e2e.backends import Docker
from dcos_e2e.cluster import Cluster
from dcos_e2e.node import Output


@pytest.mark.skipif(
    only_changed(E2E_SAFE_DEFAULT + [
        # All packages safe except named packages
        'packages/*/**',
        '!packages/{adminrouter,bootstrap,bouncer,bouncer-deps,etcd,openssl}/**',
        '!packages/python*/**',
        # All e2e tests safe except this test
        'test-e2e/test_*', '!' + escape(trailing_path(__file__, 2)),
    ]),
    reason='Only safe files modified',
)
def test_adminrouter_grpc_proxy_port(docker_backend: Docker,
                                     artifact_path: Path,
                                     request: SubRequest,
                                     log_dir: Path,
                                     rsa_keypair: Tuple[str, str],
                                     jwt_token: Callable[[str, str, int], str]
                                     ) -> None:
    random_port = random.randint(63000, 64000)

    with Cluster(
예제 #7
0
import pytest
import requests
from _pytest.fixtures import SubRequest
from cluster_helpers import wait_for_dcos_oss
from conditional import E2E_SAFE_DEFAULT, escape, only_changed, trailing_path
from dcos_e2e.base_classes import ClusterBackend
from dcos_e2e.cluster import Cluster
from dcos_e2e.node import Output


@pytest.mark.skipif(
    only_changed(E2E_SAFE_DEFAULT + [
        # All packages safe except named packages
        'packages/**',
        '!packages/*treeinfo.json',
        '!packages/{bouncer,bouncer-deps,cockroach,flask,libpq,openssl,six}/**',
        '!packages/python*/**',
        # All e2e tests safe except this test
        'test-e2e/test_*',
        '!' + escape(trailing_path(__file__, 2)),
    ]),
    reason='Only safe files modified',
)
def test_superuser_service_account_login(
        docker_backend: ClusterBackend, artifact_path: Path,
        request: SubRequest, log_dir: Path, rsa_keypair: Tuple[str, str],
        jwt_token: Callable[[str, str, int], str]) -> None:
    """
    Tests for successful superuser service account login which asserts
    that the default user has been created during cluster start.
    """
    superuser_uid = str(uuid.uuid4())