Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
[INFINITY-2064] Test upgrade (but not downgrade) in all sanity tests* (
Browse files Browse the repository at this point in the history
…#1339)

* Revert [INFINITY-2038] Support data_center and rack configuration in Cassandra #1303

* Test upgrade (but not downgrade) in all sanity tests*

* Except template

* Fix syntax in sdk_upgrade, clean up unused imports

* Fix shakedown imports, remove apparently unnecessary vendor copy

* More fixes

* Finish HDFS upgrade test

* Fixed HDFS upgrade user

* More conrete journal node readiness check

* Re-enable recovery check

* Combined readiness check methods

* Test upgrade (but not downgrade) in all sanity tests*

* Except template

* Fix syntax in sdk_upgrade, clean up unused imports

* Fix shakedown imports, remove apparently unnecessary vendor copy

* More fixes

* Finish HDFS upgrade test

* Fixed HDFS upgrade user

* Bump upgrade timeout

* Added deterministic field to HDFS's JMX lookup
  • Loading branch information
nickbp authored and gabrielhartmann committed Jul 31, 2017
1 parent 4bc5051 commit 25fd1c5
Show file tree
Hide file tree
Showing 128 changed files with 385 additions and 24,946 deletions.
2 changes: 0 additions & 2 deletions frameworks/cassandra/tests/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import json
import os

import shakedown
import sdk_hosts
import sdk_jobs
import sdk_plan
Expand Down
15 changes: 4 additions & 11 deletions frameworks/cassandra/tests/test_backup_and_restore.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import json
import os
import pytest
import shakedown
import tempfile
import uuid

from tests.config import *
import sdk_cmd as cmd
import sdk_hosts
import sdk_install
import sdk_jobs
import sdk_plan
import sdk_utils

WRITE_DATA_JOB = get_write_data_job(node_address=FOLDERED_NODE_ADDRESS)
Expand All @@ -19,23 +15,20 @@
TEST_JOBS = [WRITE_DATA_JOB, VERIFY_DATA_JOB, DELETE_DATA_JOB, VERIFY_DELETION_JOB]

no_strict = pytest.mark.skipif(os.environ.get("SECURITY") == "strict",
reason="upgrade/downgrade tests broken in strict")
reason="backup/restore tests broken in strict")

@pytest.fixture(scope='module', autouse=True)
def configure_package(configure_universe):
try:
sdk_install.uninstall(FOLDERED_SERVICE_NAME, package_name=PACKAGE_NAME)
sdk_utils.gc_frameworks()

# 1. check_suppression=False due to https://jira.mesosphere.com/browse/CASSANDRA-568
# 2. user: root because Azure CLI needs to run in root...
# user=root because Azure CLI needs to run in root...
sdk_install.install(
PACKAGE_NAME,
DEFAULT_TASK_COUNT,
service_name=FOLDERED_SERVICE_NAME,
additional_options={"service": { "name": FOLDERED_SERVICE_NAME, "user": "root" } },
check_suppression=False)
sdk_plan.wait_for_completed_deployment(FOLDERED_SERVICE_NAME)
additional_options={"service": { "name": FOLDERED_SERVICE_NAME, "user": "root" } })

tmp_dir = tempfile.mkdtemp(prefix='cassandra-test')
for job in TEST_JOBS:
Expand Down
10 changes: 5 additions & 5 deletions frameworks/cassandra/tests/test_overlay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import tempfile
import pytest

Expand Down Expand Up @@ -28,10 +27,11 @@ def configure_package(configure_universe):
sdk_install.uninstall(PACKAGE_NAME)
sdk_utils.gc_frameworks()

# check_suppression=False due to https://jira.mesosphere.com/browse/CASSANDRA-568
sdk_install.install(PACKAGE_NAME, DEFAULT_TASK_COUNT, check_suppression=False,
additional_options=sdk_networks.ENABLE_VIRTUAL_NETWORKS_OPTIONS)
sdk_plan.wait_for_completed_deployment(PACKAGE_NAME)
sdk_install.install(
PACKAGE_NAME,
DEFAULT_TASK_COUNT,
additional_options=sdk_networks.ENABLE_VIRTUAL_NETWORKS_OPTIONS)

tmp_dir = tempfile.mkdtemp(prefix='cassandra-test')
for job in TEST_JOBS:
sdk_jobs.install_job(job, tmp_dir=tmp_dir)
Expand Down
7 changes: 1 addition & 6 deletions frameworks/cassandra/tests/test_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from tests.config import *
import sdk_cmd as cmd
import sdk_install
import sdk_jobs
import sdk_marathon
import sdk_plan
import sdk_tasks
Expand All @@ -19,10 +18,7 @@ def configure_package(configure_universe):
sdk_install.uninstall(PACKAGE_NAME)
sdk_utils.gc_frameworks()

# check_suppression=False due to https://jira.mesosphere.com/browse/CASSANDRA-568
sdk_install.install(PACKAGE_NAME, DEFAULT_TASK_COUNT, check_suppression=False)

sdk_plan.wait_for_completed_deployment(PACKAGE_NAME)
sdk_install.install(PACKAGE_NAME, DEFAULT_TASK_COUNT)

yield # let the test session execute
finally:
Expand Down Expand Up @@ -52,7 +48,6 @@ def test_node_replace_replaces_node():
@sdk_utils.dcos_1_9_or_higher # dcos task exec not supported < 1.9
def test_node_replace_replaces_seed_node():
pod_to_replace = 'node-0'
pod_host = get_pod_host(pod_to_replace)

# start replace and wait for it to finish
cmd.run_cli('cassandra pod replace {}'.format(pod_to_replace))
Expand Down
12 changes: 5 additions & 7 deletions frameworks/cassandra/tests/test_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import pytest
import shakedown
import tempfile
import uuid

from tests.config import *
import sdk_cmd as cmd
import sdk_hosts
import sdk_install
import sdk_jobs
import sdk_metrics
import sdk_plan
import sdk_upgrade
import sdk_utils
import sdk_metrics


WRITE_DATA_JOB = get_write_data_job(node_address=FOLDERED_NODE_ADDRESS)
Expand All @@ -28,14 +28,12 @@ def configure_package(configure_universe):
sdk_install.uninstall(FOLDERED_SERVICE_NAME, package_name=PACKAGE_NAME)
sdk_utils.gc_frameworks()

# check_suppression=False due to https://jira.mesosphere.com/browse/CASSANDRA-568
sdk_install.install(
sdk_upgrade.test_upgrade(
"beta-{}".format(PACKAGE_NAME),
PACKAGE_NAME,
DEFAULT_TASK_COUNT,
service_name=FOLDERED_SERVICE_NAME,
additional_options={"service": { "name": FOLDERED_SERVICE_NAME } },
check_suppression=False)
sdk_plan.wait_for_completed_deployment(FOLDERED_SERVICE_NAME)
additional_options={"service": {"name": FOLDERED_SERVICE_NAME} })

tmp_dir = tempfile.mkdtemp(prefix='cassandra-test')
for job in TEST_JOBS:
Expand Down
14 changes: 7 additions & 7 deletions frameworks/cassandra/tests/test_soak.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
import shakedown

from tests.config import *
import sdk_api
import sdk_hosts
import sdk_jobs
import sdk_plan
import sdk_test_upgrade
import sdk_utils
import sdk_upgrade


@pytest.mark.soak_backup
Expand Down Expand Up @@ -47,10 +45,12 @@ def test_soak_upgrade_downgrade():
Assumes that the install options file is placed in the repo root."""
with open('cassandra.json') as options_file:
install_options = json.load(options_file)

sdk_test_upgrade.soak_upgrade_downgrade(
PACKAGE_NAME, DEFAULT_TASK_COUNT, install_options
)
sdk_upgrade.soak_upgrade_downgrade(
"beta-{}".format(PACKAGE_NAME),
PACKAGE_NAME,
DEFAULT_TASK_COUNT,
service_name=install_options["service"]["name"],
additional_options=install_options)


@pytest.mark.soak_migration
Expand Down
1 change: 0 additions & 1 deletion frameworks/elastic/tests/test_overlay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import pytest
import shakedown

Expand Down
10 changes: 6 additions & 4 deletions frameworks/elastic/tests/test_shakedown.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
import pytest

import shakedown

import sdk_cmd as cmd
Expand All @@ -8,7 +8,7 @@
import sdk_marathon
import sdk_metrics
import sdk_tasks
import sdk_test_upgrade
import sdk_upgrade
import sdk_utils
from tests.config import *

Expand All @@ -19,11 +19,13 @@ def configure_package(configure_universe):
try:
sdk_install.uninstall(FOLDERED_SERVICE_NAME, package_name=PACKAGE_NAME)
sdk_utils.gc_frameworks()
sdk_install.install(

sdk_upgrade.test_upgrade(
"beta-{}".format(PACKAGE_NAME),
PACKAGE_NAME,
DEFAULT_TASK_COUNT,
service_name=FOLDERED_SERVICE_NAME,
additional_options={"service": { "name": FOLDERED_SERVICE_NAME } })
additional_options={"service": {"name": FOLDERED_SERVICE_NAME}})

yield # let the test session execute
finally:
Expand Down
10 changes: 7 additions & 3 deletions frameworks/elastic/tests/test_soak.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import pytest
import sdk_test_upgrade
import sdk_upgrade
from tests.config import (
PACKAGE_NAME,
DEFAULT_TASK_COUNT,
Expand All @@ -13,5 +13,9 @@ def test_soak_upgrade_downgrade():
"""
with open('elastic.json') as options_file:
install_options = json.load(options_file)
sdk_test_upgrade.soak_upgrade_downgrade("beta-{}".format(PACKAGE_NAME), PACKAGE_NAME, PACKAGE_NAME,
DEFAULT_TASK_COUNT, install_options)
sdk_upgrade.soak_upgrade_downgrade(
"beta-{}".format(PACKAGE_NAME),
PACKAGE_NAME,
DEFAULT_TASK_COUNT,
service_name=install_options["service"]["name"],
additional_options=install_options)
16 changes: 0 additions & 16 deletions frameworks/elastic/tests/test_upgrade.py

This file was deleted.

6 changes: 3 additions & 3 deletions frameworks/hdfs/src/main/dist/svc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pods:
# The absence of journal-data/hdfs indicates HDFS is about to be deployed for the first time.
# We test readiness as one of two conditions:
# 1. We hit the JMX endpoint as it includes a field called "RpcDetailedActivityForPort8485".
# The "JournalNumOps" field inside of it is indicative of Journal Node operations being
# The "GetEditLogManifestNumOps" field inside of it is indicative of Journal Node operations being
# performed in coherence with the other HDFS components since the field is monitoring RPC traffic,
# hence signaling that the Journal Node is ready. Or
# 2. The existence of journal-data/hdfs/current/committed-txid is used during an update plan
Expand All @@ -73,11 +73,11 @@ pods:
exit 0
else
curl journal-$POD_INSTANCE_INDEX-node.$FRAMEWORK_HOST:$JOURNAL_NODE_HTTP_PORT/jmx > tmpJmx.json &&
export JOURNAL_NUM_OPS=$(grep "JournalNumOps" tmpJmx.json | sed s/,//g | awk '{print $3}') &&
export EDIT_MANIFEST_NUM_OPS=$(grep "GetEditLogManifestNumOps" tmpJmx.json | sed s/,//g | awk '{print $3}') &&
export COMMITTED_ID_TIME=$(ls -l --time-style='+%Y-%m-%d %H:%M:%S' journal-data/hdfs/current/committed-txid | awk '{print $6 FS $7}') &&
export CURRENT_TIME=$(date '+%Y-%m-%d %H:%M:%S') &&
export TIME_DIFF=$(( ( $(date -ud "$CURRENT_TIME" +'%s') - $(date -ud "$COMMITTED_ID_TIME" +'%s') ) )) &&
[[ $JOURNAL_NUM_OPS -gt 0 || $TIME_DIFF -le 12 ]]
[[ $EDIT_MANIFEST_NUM_OPS -gt 0 || $TIME_DIFF -le 12 ]]
fi
delay: 60
interval: 3
Expand Down
10 changes: 5 additions & 5 deletions frameworks/hdfs/tests/test_overlay.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import os
import pytest
import time

from xml.etree import ElementTree
# Do not use import *; it makes it harder to determine the origin of config
Expand All @@ -12,6 +10,7 @@
import sdk_networks
import sdk_utils
import sdk_plan
import sdk_tasks

import shakedown

Expand All @@ -20,9 +19,10 @@ def configure_package(configure_universe):
try:
sdk_install.uninstall(PACKAGE_NAME)
sdk_utils.gc_frameworks()
sdk_install.install(PACKAGE_NAME, DEFAULT_TASK_COUNT,
additional_options=sdk_networks.ENABLE_VIRTUAL_NETWORKS_OPTIONS)
sdk_plan.wait_for_completed_deployment(PACKAGE_NAME)
sdk_install.install(
PACKAGE_NAME,
DEFAULT_TASK_COUNT,
additional_options=sdk_networks.ENABLE_VIRTUAL_NETWORKS_OPTIONS)

yield # let the test session execute
finally:
Expand Down
14 changes: 11 additions & 3 deletions frameworks/hdfs/tests/test_shakedown.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
import time
import xml.etree.ElementTree as etree

import shakedown
Expand All @@ -8,10 +7,11 @@
import sdk_hosts
import sdk_install
import sdk_marathon
import sdk_metrics
import sdk_plan
import sdk_tasks
import sdk_upgrade
import sdk_utils
import sdk_metrics
from tests.config import *


Expand All @@ -20,12 +20,20 @@ def configure_package(configure_universe):
try:
sdk_install.uninstall(FOLDERED_SERVICE_NAME, package_name=PACKAGE_NAME)
sdk_utils.gc_frameworks()

# TODO: upgrade test here fails due to released beta-hdfs not supporting foldered names.
# After the next beta-hdfs release (with folder support), delete test_upgrade.py and uncomment this.
#sdk_upgrade.test_upgrade(
# "beta-{}".format(PACKAGE_NAME),
# PACKAGE_NAME,
# DEFAULT_TASK_COUNT,
# service_name=FOLDERED_SERVICE_NAME,
# additional_options={"service": {"name": FOLDERED_SERVICE_NAME}})
sdk_install.install(
PACKAGE_NAME,
DEFAULT_TASK_COUNT,
service_name=FOLDERED_SERVICE_NAME,
additional_options={"service": { "name": FOLDERED_SERVICE_NAME } })
sdk_plan.wait_for_completed_deployment(FOLDERED_SERVICE_NAME)

yield # let the test session execute
finally:
Expand Down
32 changes: 32 additions & 0 deletions frameworks/hdfs/tests/test_upgrade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import pytest

import sdk_install
import sdk_upgrade
import sdk_utils
from tests.config import *


@pytest.fixture(scope='module', autouse=True)
def configure_package(configure_universe):
try:
sdk_install.uninstall(PACKAGE_NAME, package_name=PACKAGE_NAME)
sdk_utils.gc_frameworks()

# TODO: This test is only here because we can't currently test upgrades on a foldered service
# After the next beta-hdfs release (with folder support), delete test_upgrade.py and uncomment the upgrade test in test_shakedown.py
sdk_upgrade.test_upgrade(
"beta-{}".format(PACKAGE_NAME),
PACKAGE_NAME,
DEFAULT_TASK_COUNT,
service_name=PACKAGE_NAME,
additional_options={"service": {"name": PACKAGE_NAME} },
test_version_options={"service": {"name": PACKAGE_NAME, "user": "root"} })

yield # let the test session execute
finally:
sdk_install.uninstall(PACKAGE_NAME, package_name=PACKAGE_NAME)


@pytest.mark.sanity
def test_upgrade():
check_healthy()
3 changes: 1 addition & 2 deletions frameworks/helloworld/tests/test_canary_strategy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest
import json
import traceback

import shakedown
import sdk_cmd
Expand Down Expand Up @@ -28,7 +27,7 @@ def configure_package(configure_universe):
'hello': {'count': 4},
'world': {'count': 4}
},
check_suppression=False)
wait_scheduler_idle=False)

yield # let the test session execute
finally:
Expand Down
1 change: 0 additions & 1 deletion frameworks/helloworld/tests/test_executor_volumes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest

import shakedown
import sdk_install
import sdk_plan
import sdk_utils
Expand Down
Loading

0 comments on commit 25fd1c5

Please sign in to comment.