test updates due to new DC/OS release (#709)

This commit is contained in:
tamarrow
2016-08-10 20:32:13 -07:00
committed by GitHub
parent 1431a48daf
commit 2b84f17fa4
17 changed files with 338 additions and 336 deletions

View File

@@ -1,80 +1,38 @@
{
"pip": [
"dcos==0.1.13",
"git+https://github.com/mesosphere/dcos-cassandra.git#dcos-cassandra=0.1.0"
"https://s3-eu-west-1.amazonaws.com/downloads.mesosphere.com/kafka/dcos-kafka-0.2.1.tar.gz"
]
}
{
"id": "/cassandra/{{cassandra.cluster-name}}",
"cmd": "$(pwd)/jre*/bin/java $JAVA_OPTS -classpath cassandra-mesos-framework.jar io.mesosphere.mesos.frameworks.cassandra.framework.Main",
"instances": {{cassandra.framework.instances}},
"cpus": {{cassandra.framework.cpus}},
"mem": {{cassandra.framework.mem}},
"ports": [
0
],
"id": "{{kafka.framework-name}}",
"cpus": {{kafka.app.cpus}},
"mem": {{kafka.app.mem}},
"instances": {{kafka.app.instances}},
"cmd": "jre/bin/java -Xmx{{kafka.app.heap-mb}}m -jar kafka-mesos*.jar scheduler --master={{mesos.master}} --zk={{kafka.zk}} --api={{kafka.api}} --storage=\"{{kafka.storage}}\" --jre={{kafka.jre}} {{#kafka.user}}--user=\"{{kafka.user}}\"{{/kafka.user}} --framework-name=\"{{kafka.framework-name}}\" --framework-role=\"{{kafka.framework-role}}\" {{#kafka.principal}}--principal=\"{{kafka.principal}}\"{{/kafka.principal}} {{#kafka.secret}}--secret=\"{{kafka.secret}}\"{{/kafka.secret}} --log=scheduler.log {{kafka.other-options}}",
"uris": [
"{{resource.assets.uris.cassandra-mesos-0-2-0-1-tar-gz}}",
"{{resource.assets.uris.jre-7u76-linux-x64-tar-gz}}"
"{{resource.assets.uris.jre-7u79-openjdk-tgz}}",
"{{resource.assets.uris.kafka_2-10-0-9-0-0-tgz}}",
"{{resource.assets.uris.kafka-mesos-0-9-4-0-jar}}"
],
"ports": [0],
"healthChecks": [
{
"gracePeriodSeconds": 120,
"intervalSeconds": 15,
"maxConsecutiveFailures": 0,
"path": "/health/cluster",
"portIndex": 0,
"protocol": "HTTP",
"timeoutSeconds": 5
"path": "/health",
"gracePeriodSeconds": 120,
"intervalSeconds": 60,
"portIndex": 0,
"timeoutSeconds": 30,
"maxConsecutiveFailures": 3
},
{
"gracePeriodSeconds": 120,
"intervalSeconds": 30,
"maxConsecutiveFailures": 3,
"path": "/health/process",
"portIndex": 0,
"protocol": "HTTP",
"timeoutSeconds": 5
"path": "/api/broker/list",
"gracePeriodSeconds": 120,
"intervalSeconds": 60,
"portIndex": 0,
"timeoutSeconds": 30,
"maxConsecutiveFailures": 0
}
],
"labels": {
"DCOS_PACKAGE_FRAMEWORK_NAME": "cassandra.{{cassandra.cluster-name}}"
},
"env": {
"MESOS_ZK": "{{mesos.master}}"
,"JAVA_OPTS": "-Xms256m -Xmx256m"
,"CASSANDRA_CLUSTER_NAME": "{{cassandra.cluster-name}}"
,"CASSANDRA_NODE_COUNT": "{{cassandra.node-count}}"
,"CASSANDRA_SEED_COUNT": "{{cassandra.seed-count}}"
,"CASSANDRA_RESOURCE_CPU_CORES": "{{cassandra.resources.cpus}}"
,"CASSANDRA_RESOURCE_MEM_MB": "{{cassandra.resources.mem}}"
,"CASSANDRA_RESOURCE_DISK_MB": "{{cassandra.resources.disk}}"
,"CASSANDRA_FAILOVER_TIMEOUT_SECONDS": "{{cassandra.framework.failover-timeout-seconds}}"
,"CASSANDRA_DATA_DIRECTORY": "{{cassandra.data-directory}}"
,"CASSANDRA_HEALTH_CHECK_INTERVAL_SECONDS": "{{cassandra.health-check-interval-seconds}}"
,"CASSANDRA_ZK_TIMEOUT_MS": "{{cassandra.zk-timeout-ms}}"
,"CASSANDRA_BOOTSTRAP_GRACE_TIME_SECONDS": "{{cassandra.bootstrap-grace-time-seconds}}"
,"CASSANDRA_FRAMEWORK_MESOS_ROLE": "{{cassandra.framework.role}}"
,"CASSANDRA_DEFAULT_DC": "{{cassandra.dc.default-dc}}"
,"CASSANDRA_DEFAULT_RACK": "{{cassandra.dc.default-rack}}"
,"MESOS_AUTHENTICATE": "{{cassandra.framework.authentication.enabled}}"
{{#cassandra.dc.external-dcs}}
,"CASSANDRA_EXTERNAL_DC_{{name}}": "{{url}}"
{{/cassandra.dc.external-dcs}}
{{#cassandra.zk}} {{! if the full cassandra zk url has been specified use it }}
,"CASSANDRA_ZK": "{{cassandra.zk}}"
{{/cassandra.zk}}
{{^cassandra.zk}} {{! else, create a url based on convention and cluster name }}
,"CASSANDRA_ZK": "zk://master.mesos:2181/cassandra-mesos/{{cassandra.cluster-name}}"
{{/cassandra.zk}}
{{#cassandra.resource.heap-mb}}
,"CASSANDRA_RESOURCE_HEAP_MB": "{{cassandra.resource.heap-mb}}"
{{/cassandra.resource.heap-mb}}
{{#cassandra.framework.authentication.principal}}
,"DEFAULT_PRINCIPAL": "{{cassandra.framework.authentication.principal}}"
{{/cassandra.framework.authentication.principal}}
{{#cassandra.framework.authentication.secret}}
,"DEFAULT_SECRET": "{{cassandra.framework.authentication.secret}}"
{{/cassandra.framework.authentication.secret}}
}
]
}

View File

@@ -1,6 +0,0 @@
{
"pip": [
"dcos==0.1.13",
"git+https://github.com/mesosphere/dcos-cassandra.git#dcos-cassandra=0.1.0"
]
}

View File

@@ -0,0 +1,5 @@
{
"pip": [
"https://s3-eu-west-1.amazonaws.com/downloads.mesosphere.com/kafka/dcos-kafka-0.2.1.tar.gz"
]
}

View File

@@ -14,6 +14,7 @@
"postUninstallNotes": "The Marathon DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/marathon/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 2 CPU's and 1GB of RAM available for the Marathon Service.",
"scm": "https://github.com/mesosphere/marathon.git",
"selected": false,
"tags": [
"init",
"long-running"

View File

@@ -13,6 +13,7 @@
"postInstallNotes": "Marathon DCOS Service has been successfully installed!\n\n\tDocumentation: https://mesosphere.github.io/marathon\n\tIssues: https:/github.com/mesosphere/marathon/issues\n",
"postUninstallNotes": "The Marathon DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/marathon/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 2 CPU's and 1GB of RAM available for the Marathon Service.",
"selected": false,
"scm": "https://github.com/mesosphere/marathon.git",
"tags": [
"init",

View File

@@ -13,6 +13,7 @@
"postInstallNotes": "Marathon DCOS Service has been successfully installed!\n\n\tDocumentation: https://mesosphere.github.io/marathon\n\tIssues: https:/github.com/mesosphere/marathon/issues\n",
"postUninstallNotes": "The Marathon DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/marathon/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 2 CPU's and 1GB of RAM available for the Marathon Service.",
"selected": false,
"scm": "https://github.com/mesosphere/marathon.git",
"tags": [
"init",

View File

@@ -0,0 +1,29 @@
[
{
"apps": [
"/chronos"
],
"description": "A fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules.",
"framework": true,
"licenses": [
{
"name": "Apache License Version 2.0",
"url": "https://github.com/mesos/chronos/blob/master/LICENSE"
}
],
"maintainer": "support@mesosphere.io",
"name": "chronos",
"packagingVersion": "2.0",
"postInstallNotes": "Chronos DCOS Service has been successfully installed!\n\n\tDocumentation: http://mesos.github.io/chronos\n\tIssues: https://github.com/mesos/chronos/issues",
"postUninstallNotes": "The Chronos DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/chronos/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 1 CPU and 2GB of RAM available for the Chronos Service.",
"scm": "https://github.com/mesos/chronos.git",
"selected": false,
"tags": [
"cron",
"analytics",
"batch"
],
"version": "2.4.0"
}
]

View File

@@ -1,14 +1,15 @@
{
[
{
"apps": [
"/chronos"
"/chronos"
],
"description": "A fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules.",
"framework": true,
"licenses": [
{
"name": "Apache License Version 2.0",
"url": "https://github.com/mesos/chronos/blob/master/LICENSE"
}
{
"name": "Apache License Version 2.0",
"url": "https://github.com/mesos/chronos/blob/master/LICENSE"
}
],
"maintainer": "support@mesosphere.io",
"name": "chronos",
@@ -17,10 +18,12 @@
"postUninstallNotes": "The Chronos DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/chronos/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 1 CPU and 2GB of RAM available for the Chronos Service.",
"scm": "https://github.com/mesos/chronos.git",
"selected": false,
"tags": [
"cron",
"analytics",
"batch"
"cron",
"analytics",
"batch"
],
"version": "2.4.0"
}
}
]

View File

@@ -1,28 +1,30 @@
{
"apps": [
"/chronos-user-1",
"/chronos-user-2"
],
"description": "A fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules.",
"framework": true,
"licenses": [
{
"name": "Apache License Version 2.0",
"url": "https://github.com/mesos/chronos/blob/master/LICENSE"
}
],
"maintainer": "support@mesosphere.io",
"name": "chronos",
"packagingVersion": "2.0",
"postInstallNotes": "Chronos DCOS Service has been successfully installed!\n\n\tDocumentation: http://mesos.github.io/chronos\n\tIssues: https://github.com/mesos/chronos/issues",
"postUninstallNotes": "The Chronos DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/chronos/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 1 CPU and 2GB of RAM available for the Chronos Service.",
"scm": "https://github.com/mesos/chronos.git",
"tags": [
"cron",
"analytics",
"batch"
],
"version": "2.4.0"
}
[
{
"apps": [
"/chronos-user-1",
"/chronos-user-2"
],
"description": "A fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules.",
"framework": true,
"licenses": [
{
"name": "Apache License Version 2.0",
"url": "https://github.com/mesos/chronos/blob/master/LICENSE"
}
],
"maintainer": "support@mesosphere.io",
"name": "chronos",
"packagingVersion": "2.0",
"postInstallNotes": "Chronos DCOS Service has been successfully installed!\n\n\tDocumentation: http://mesos.github.io/chronos\n\tIssues: https://github.com/mesos/chronos/issues",
"postUninstallNotes": "The Chronos DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/chronos/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 1 CPU and 2GB of RAM available for the Chronos Service.",
"scm": "https://github.com/mesos/chronos.git",
"selected": false,
"tags": [
"cron",
"analytics",
"batch"
],
"version": "2.4.0"
}
]

View File

@@ -1,26 +1,29 @@
{
"apps": [
"/chronos-user-1"
],
"description": "A fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules.",
"framework": true,
"licenses": [
{
"name": "Apache License Version 2.0",
"url": "https://github.com/mesos/chronos/blob/master/LICENSE"
}
],
"maintainer": "support@mesosphere.io",
"name": "chronos",
"packagingVersion": "2.0",
"postInstallNotes": "Chronos DCOS Service has been successfully installed!\n\n\tDocumentation: http://mesos.github.io/chronos\n\tIssues: https://github.com/mesos/chronos/issues",
"postUninstallNotes": "The Chronos DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/chronos/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 1 CPU and 2GB of RAM available for the Chronos Service.",
"scm": "https://github.com/mesos/chronos.git",
"tags": [
"cron",
"analytics",
"batch"
],
"version": "2.4.0"
}
[
{
"apps": [
"/chronos-user-1"
],
"description": "A fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules.",
"framework": true,
"licenses": [
{
"name": "Apache License Version 2.0",
"url": "https://github.com/mesos/chronos/blob/master/LICENSE"
}
],
"maintainer": "support@mesosphere.io",
"name": "chronos",
"packagingVersion": "2.0",
"postInstallNotes": "Chronos DCOS Service has been successfully installed!\n\n\tDocumentation: http://mesos.github.io/chronos\n\tIssues: https://github.com/mesos/chronos/issues",
"postUninstallNotes": "The Chronos DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/chronos/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 1 CPU and 2GB of RAM available for the Chronos Service.",
"scm": "https://github.com/mesos/chronos.git",
"selected": false,
"tags": [
"cron",
"analytics",
"batch"
],
"version": "2.4.0"
}
]

View File

@@ -1,27 +1,29 @@
{
"apps": [
"/chronos-user-2"
],
"description": "A fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules.",
"framework": true,
"licenses": [
{
"name": "Apache License Version 2.0",
"url": "https://github.com/mesos/chronos/blob/master/LICENSE"
}
],
"maintainer": "support@mesosphere.io",
"name": "chronos",
"packagingVersion": "2.0",
"postInstallNotes": "Chronos DCOS Service has been successfully installed!\n\n\tDocumentation: http://mesos.github.io/chronos\n\tIssues: https://github.com/mesos/chronos/issues",
"postUninstallNotes": "The Chronos DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/chronos/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 1 CPU and 2GB of RAM available for the Chronos Service.",
"scm": "https://github.com/mesos/chronos.git",
"tags": [
"cron",
"analytics",
"batch"
],
"version": "2.4.0"
}
[
{
"apps": [
"/chronos-user-2"
],
"description": "A fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules.",
"framework": true,
"licenses": [
{
"name": "Apache License Version 2.0",
"url": "https://github.com/mesos/chronos/blob/master/LICENSE"
}
],
"maintainer": "support@mesosphere.io",
"name": "chronos",
"packagingVersion": "2.0",
"postInstallNotes": "Chronos DCOS Service has been successfully installed!\n\n\tDocumentation: http://mesos.github.io/chronos\n\tIssues: https://github.com/mesos/chronos/issues",
"postUninstallNotes": "The Chronos DCOS Service has been uninstalled and will no longer run.\nPlease follow the instructions at http://docs.mesosphere.com/services/chronos/#uninstall to clean up any persisted state",
"preInstallNotes": "We recommend a minimum of one node with at least 1 CPU and 2GB of RAM available for the Chronos Service.",
"scm": "https://github.com/mesos/chronos.git",
"selected": false,
"tags": [
"cron",
"analytics",
"batch"
],
"version": "2.4.0"
}
]

View File

@@ -0,0 +1,25 @@
[
{
"apps": [
"/helloworld"
],
"command": {
"name": "helloworld"
},
"description": "Example DCOS application package",
"framework": false,
"maintainer": "support@mesosphere.io",
"name": "helloworld",
"packagingVersion": "2.0",
"postInstallNotes": "A sample post-installation message",
"preInstallNotes": "A sample pre-installation message",
"selected": false,
"tags": [
"mesosphere",
"example",
"subcommand"
],
"version": "0.1.0",
"website": "https://github.com/mesosphere/dcos-helloworld"
}
]

View File

@@ -0,0 +1,22 @@
[
{
"command": {
"name": "helloworld"
},
"description": "Example DCOS application package",
"framework": false,
"maintainer": "support@mesosphere.io",
"name": "helloworld",
"packagingVersion": "2.0",
"postInstallNotes": "A sample post-installation message",
"preInstallNotes": "A sample pre-installation message",
"selected": false,
"tags": [
"mesosphere",
"example",
"subcommand"
],
"version": "0.1.0",
"website": "https://github.com/mesosphere/dcos-helloworld"
}
]

View File

@@ -24,6 +24,11 @@ def setup_module(module):
def teardown_module(module):
services = get_services()
for framework in services:
if framework['name'] == 'chronos':
service_shutdown(framework['id'])
assert_command(
['dcos', 'package', 'repo', 'remove', 'test4'])
repo = "https://universe.mesosphere.com/repo"
@@ -154,14 +159,14 @@ def test_describe():
assert returncode_ == 0
output = json.loads(stdout_.decode('utf-8'))
assert _remove_nulls(output) == json.loads(stdout.decode('utf-8'))
assert output == json.loads(stdout.decode('utf-8'))
assert stderr_ == b''
def test_describe_cli():
stdout = file_json(
'tests/data/package/json/test_describe_cli_cassandra.json')
assert_command(['dcos', 'package', 'describe', 'cassandra', '--cli'],
'tests/data/package/json/test_describe_cli_kafka.json')
assert_command(['dcos', 'package', 'describe', 'kafka', '--cli'],
stdout=stdout)
@@ -180,7 +185,6 @@ def test_describe_config():
def test_describe_render():
# DCOS_PACKAGE_METADATA label will need to be changed after issue 431
stdout = file_json(
'tests/data/package/json/test_describe_marathon_app_render.json')
stdout = json.loads(stdout.decode('utf-8'))
@@ -197,7 +201,7 @@ def test_describe_render():
# We covert the metadata into a dictionary
# so that failures in equality are more descriptive
assert base64_to_dict(value) == \
base64_to_dict(actual_labels.get(label))
base64_to_dict(actual_labels.get(label))
else:
assert value == actual_labels.get(label)
@@ -216,7 +220,7 @@ def test_describe_package_version():
assert returncode_ == 0
output = json.loads(stdout_.decode('utf-8'))
assert _remove_nulls(output) == json.loads(stdout.decode('utf-8'))
assert output == json.loads(stdout.decode('utf-8'))
assert stderr_ == b''
@@ -264,7 +268,7 @@ def test_describe_options():
# We covert the metadata into a dictionary
# so that failures in equality are more descriptive
assert base64_to_dict(value) == \
base64_to_dict(actual_labels.get(label))
base64_to_dict(actual_labels.get(label))
else:
assert value == actual_labels.get(label)
@@ -277,7 +281,7 @@ def test_describe_app_cli():
stdout = file_bytes(
'tests/data/package/json/test_describe_app_cli.json')
assert_command(
['dcos', 'package', 'describe', 'cassandra', '--app', '--cli'],
['dcos', 'package', 'describe', 'kafka', '--app', '--cli'],
stdout=stdout)
@@ -291,7 +295,7 @@ def test_describe_specific_version():
assert returncode_ == 0
output = json.loads(stdout_.decode('utf-8'))
assert _remove_nulls(output) == json.loads(stdout.decode('utf-8'))
assert output == json.loads(stdout.decode('utf-8'))
assert stderr_ == b''
@@ -308,11 +312,9 @@ Please create a JSON file with the appropriate options, and pass the \
def test_install(zk_znode):
_install_chronos()
watch_all_deployments()
wait_for_service('chronos')
_uninstall_chronos()
watch_all_deployments()
with _chronos_package():
watch_all_deployments()
wait_for_service('chronos')
services = get_services(args=['--inactive'])
assert len([service for service in services
if service['name'] == 'chronos']) == 0
@@ -435,8 +437,6 @@ cli-test-4.zip"""
for label, value in expected_labels.items():
assert value == six.b(app_labels.get(label))
# these labels are different for cosmos b/c of null problem
# we have cosmos tests for test, and will fix in issue 431
assert expected_metadata == base64_to_dict(six.b(
app_labels.get('DCOS_PACKAGE_METADATA')))
assert expected_command == base64_to_dict(six.b(
@@ -445,11 +445,13 @@ cli-test-4.zip"""
# test local package.json
package = {
"description": "Example DCOS application package",
"framework": False,
"maintainer": "support@mesosphere.io",
"name": "helloworld",
"packagingVersion": "2.0",
"postInstallNotes": "A sample post-installation message",
"preInstallNotes": "A sample pre-installation message",
"selected": False,
"tags": ["mesosphere", "example", "subcommand"],
"version": "0.1.0",
"website": "https://github.com/mesosphere/dcos-helloworld",
@@ -458,7 +460,7 @@ cli-test-4.zip"""
helloworld_subcommand = subcommand.InstalledSubcommand("helloworld")
# test local package.json
assert _remove_nulls(helloworld_subcommand.package_json()) == package
assert helloworld_subcommand.package_json() == package
# uninstall helloworld
_uninstall_helloworld()
@@ -542,11 +544,13 @@ def test_uninstall_cli():
"/helloworld"
],
"description": "Example DCOS application package",
"framework": false,
"maintainer": "support@mesosphere.io",
"name": "helloworld",
"packagingVersion": "2.0",
"postInstallNotes": "A sample post-installation message",
"preInstallNotes": "A sample pre-installation message",
"selected": false,
"tags": [
"mesosphere",
"example",
@@ -561,7 +565,7 @@ def test_uninstall_cli():
assert stderr_ == b''
assert returncode_ == 0
output = json.loads(stdout_.decode('utf-8'))[0]
assert _remove_nulls(output) == json.loads(stdout.decode('utf-8'))
assert output == json.loads(stdout.decode('utf-8'))
_uninstall_helloworld()
@@ -610,20 +614,17 @@ def test_list(zk_znode):
_list(args=['xyzzy', '--json'])
_list(args=['--app-id=/xyzzy', '--json'])
_install_chronos()
with _chronos_package():
expected_output = file_json(
'tests/data/package/json/test_list_chronos.json')
expected_output = file_json(
'tests/data/package/json/test_list_chronos.json')
_list(stdout=expected_output)
_list(args=['--json', 'chronos'], stdout=expected_output)
_list(args=['--json', '--app-id=/chronos'], stdout=expected_output)
_list_remove_nulls(stdout=expected_output)
_list_remove_nulls(args=['--json', 'chronos'], stdout=expected_output)
_list_remove_nulls(args=['--json', '--app-id=/chronos'],
stdout=expected_output)
_list(args=['--json', 'ceci-nest-pas-une-package'])
_list(args=['--json', '--app-id=/ceci-nest-pas-une-package'])
_uninstall_chronos()
def test_list_table():
with _helloworld():
@@ -657,31 +658,10 @@ def test_install_no():
def test_list_cli():
stdout = b"""
{
"apps": [
"/helloworld"
],
"command": {
"name": "helloworld"
},
"description": "Example DCOS application package",
"maintainer": "support@mesosphere.io",
"name": "helloworld",
"packagingVersion": "2.0",
"postInstallNotes": "A sample post-installation message",
"preInstallNotes": "A sample pre-installation message",
"tags": [
"mesosphere",
"example",
"subcommand"
],
"version": "0.1.0",
"website": "https://github.com/mesosphere/dcos-helloworld"
}
"""
_install_helloworld()
_list_remove_nulls(stdout=stdout)
stdout = file_json(
'tests/data/package/json/test_list_helloworld.json')
_list(stdout=stdout)
_uninstall_helloworld()
stdout = (b"Installing CLI subcommand for package [helloworld] " +
@@ -691,27 +671,10 @@ def test_list_cli():
b"\n")
_install_helloworld(args=['--cli', '--yes'], stdout=stdout)
stdout = b"""\
{
"command": {
"name": "helloworld"
},
"description": "Example DCOS application package",
"maintainer": "support@mesosphere.io",
"name": "helloworld",
"packagingVersion": "2.0",
"postInstallNotes": "A sample post-installation message",
"preInstallNotes": "A sample pre-installation message",
"tags": [
"mesosphere",
"example",
"subcommand"
],
"version": "0.1.0",
"website": "https://github.com/mesosphere/dcos-helloworld"
}
"""
_list_remove_nulls(stdout=stdout)
stdout = file_json(
'tests/data/package/json/test_list_helloworld_cli.json')
_list(stdout=stdout)
_uninstall_cli_helloworld()
@@ -726,15 +689,14 @@ def test_uninstall_multiple_frameworknames(zk_znode):
expected_output = file_json(
'tests/data/package/json/test_list_chronos_two_users.json')
# issue 431
_list_remove_nulls(stdout=expected_output)
_list_remove_nulls(args=['--json', 'chronos'], stdout=expected_output)
_list_remove_nulls(args=['--json', '--app-id=/chronos-user-1'],
stdout=file_json(
_list(stdout=expected_output)
_list(args=['--json', 'chronos'], stdout=expected_output)
_list(args=['--json', '--app-id=/chronos-user-1'],
stdout=file_json(
'tests/data/package/json/test_list_chronos_user_1.json'))
_list_remove_nulls(args=['--json', '--app-id=/chronos-user-2'],
stdout=file_json(
_list(args=['--json', '--app-id=/chronos-user-2'],
stdout=file_json(
'tests/data/package/json/test_list_chronos_user_2.json'))
_uninstall_chronos(
@@ -952,22 +914,45 @@ def _install_chronos(
stdin=stdin)
@contextlib.contextmanager
def _chronos_package(
args=['--yes'],
returncode=0,
stdout=b'Installing Marathon app for package [chronos] '
b'version [2.4.0]\n',
stderr=b'',
preInstallNotes=b'We recommend a minimum of one node with at least 1 '
b'CPU and 2GB of RAM available for the Chronos '
b'Service.\n',
postInstallNotes=b'Chronos DCOS Service has been successfully '
b'''installed!
\tDocumentation: http://mesos.github.io/chronos
\tIssues: https://github.com/mesos/chronos/issues\n''',
stdin=None):
_install_chronos(
args,
returncode,
stdout,
stderr,
preInstallNotes,
postInstallNotes,
stdin)
try:
yield
finally:
_uninstall_chronos()
delete_zk_node('chronos')
watch_all_deployments()
def _list(args=['--json'],
stdout=b'[]\n'):
assert_command(['dcos', 'package', 'list'] + args,
stdout=stdout)
def _list_remove_nulls(args=['--json'], stdout=b'[]\n'):
returncode_, stdout_, stderr_ = exec_command(
['dcos', 'package', 'list'] + args)
assert returncode_ == 0
output = json.loads(stdout_.decode('utf-8'))[0]
assert _remove_nulls(output) == json.loads(stdout.decode('utf-8'))
assert stderr_ == b''
def _helloworld():
stdout = (b'A sample pre-installation message\n'
b'Installing Marathon app for package [helloworld] version '
@@ -1022,16 +1007,3 @@ def _repo_add(args=[], repo_list=[]):
def _repo_remove(args=[], repo_list=[]):
assert_command(['dcos', 'package', 'repo', 'remove'] + args)
assert_command(['dcos', 'package', 'repo', 'list'], stdout=repo_list)
# issue 431
def _remove_nulls(output):
"""Remove nulls from dict. Temporary until we fix this in cosmos
:param output: dict with possible null values
:type output: dict
:returns: dict without null
:rtype: dict
"""
return {k: v for k, v in output.items() if v}

View File

@@ -12,9 +12,8 @@ import pytest
from ..fixtures.service import framework_fixture
from .common import (assert_command, assert_lines, delete_zk_node,
delete_zk_nodes, exec_command, get_services,
package_install, package_uninstall, remove_app,
service_shutdown, ssh_output, wait_for_service,
watch_all_deployments)
package_install, remove_app, service_shutdown,
ssh_output, wait_for_service)
def setup_module(module):
@@ -22,18 +21,11 @@ def setup_module(module):
['dcos', 'package', 'repo', 'remove', 'Universe'])
repo = "https://github.com/mesosphere/universe/archive/cli-test-4.zip"
assert_command(['dcos', 'package', 'repo', 'add', 'test4', repo])
package_install('chronos', True)
def teardown_module(module):
package_uninstall(
'chronos',
stderr=b'Uninstalled package [chronos] version [2.4.0]\n'
b'The Chronos DCOS Service has been uninstalled and will no '
b'longer run.\nPlease follow the instructions at http://docs.'
b'mesosphere.com/services/chronos/#uninstall to clean up any '
b'persisted state\n')
delete_zk_nodes()
assert_command(
['dcos', 'package', 'repo', 'remove', 'test4'])
repo = "https://universe.mesosphere.com/repo"
@@ -52,7 +44,7 @@ def test_info():
def test_service():
services = get_services(2)
services = get_services()
schema = _get_schema(framework_fixture())
for srv in services:
@@ -64,92 +56,79 @@ def test_service_table():
def test_service_inactive():
package_install('cassandra', True, ['--package-version=0.2.0-1'])
package_install('kafka', True, ['--app'])
wait_for_service('kafka')
# assert kafka is listed
services = get_services()
assert any(
service['name'] == 'kafka' for service in services)
# stop the kafka task
exec_command(['dcos', 'marathon', 'app', 'stop', '/kafka', '--force'])
# wait long enough for it to register
time.sleep(5)
# assert kafka is not listed
assert not any(
service['name'] == 'kafka' for service in get_services())
# assert marathon, chronos, and cassandra are listed
get_services(3)
# assert kafka is inactive
inactive = get_services(args=['--inactive'])
assert any(service['name'] == 'kafka' for service in inactive)
# uninstall cassandra using marathon. For now, need to explicitly remove
# the group that is left by cassandra. See MARATHON-144
assert_command(['dcos', 'marathon', 'group', 'remove', '/cassandra'])
watch_all_deployments()
# I'm not quite sure why we have to sleep, but it seems cassandra
# only transitions to "inactive" after a few seconds.
time.sleep(5)
# assert only marathon and chronos are active
get_services(2)
# assert marathon, chronos, and cassandra are inactive
services = get_services(args=['--inactive'])
assert len(services) >= 3
# shutdown the cassandra framework
for framework in services:
if framework['name'] == 'cassandra.dcos':
service_shutdown(framework['id'])
# assert marathon, chronos are only listed with --inactive
get_services(2, ['--inactive'])
delete_zk_node('cassandra-mesos')
package_uninstall('cassandra')
delete_zk_node('kafka-mesos')
exec_command(['dcos', 'package', 'uninstall', 'kafka'])
def test_service_completed():
package_install('cassandra', True, ['--package-version=0.2.0-1'])
package_install('kafka', True, ['--app'])
wait_for_service('kafka')
time.sleep(5)
services = get_services()
services = get_services(3)
# get cassandra's framework ID
cassandra_id = None
# get kafka's framework ID
kafka_id = None
for service in services:
if service['name'] == 'cassandra.dcos':
cassandra_id = service['id']
if service['name'] == 'kafka':
kafka_id = service['id']
break
assert cassandra_id is not None
assert kafka_id is not None
assert_command(['dcos', 'marathon', 'group', 'remove', '/cassandra'])
service_shutdown(cassandra_id)
delete_zk_node('cassandra-mesos')
service_shutdown(kafka_id)
delete_zk_node('kafka-mesos')
# assert cassandra is not running
services = get_services(2)
assert not any(service['id'] == cassandra_id for service in services)
# assert kafka is not running
services = get_services()
assert not any(service['id'] == kafka_id for service in services)
# assert cassandra is completed
# assert kafka is completed
services = get_services(args=['--completed'])
assert len(services) >= 3
assert any(service['id'] == cassandra_id for service in services)
assert any(service['id'] == kafka_id for service in services)
package_uninstall('cassandra')
delete_zk_node('kafka-mesos')
exec_command(['dcos', 'package', 'uninstall', 'kafka'])
def test_log():
package_install('cassandra', args=['--package-version=0.2.0-1'])
returncode, stdout, stderr = exec_command(
['dcos', 'service', 'log', 'chronos'])
['dcos', 'service', 'log', 'cassandra.dcos'])
assert returncode == 0
assert len(stdout.decode('utf-8').split('\n')) > 1
assert stderr == b''
def test_log_file():
returncode, stdout, stderr = exec_command(
['dcos', 'service', 'log', 'chronos', 'stderr'])
['dcos', 'service', 'log', 'cassandra.dcos', 'stderr'])
assert returncode == 0
assert len(stdout.decode('utf-8').split('\n')) > 1
assert stderr == b''
exec_command(['dcos', 'package', 'uninstall', 'cassandra'])
exec_command(['dcos', 'marathon', 'group', 'remove', 'cassandra'])
def test_log_marathon_file():
@@ -197,8 +176,10 @@ def test_log_config():
def test_log_follow():
wait_for_service('chronos')
package_install('chronos', deploy=True)
args = ['dcos', 'service', 'log', 'chronos', '--follow']
if sys.platform == 'win32':
proc = subprocess.Popen(
args,
@@ -213,6 +194,7 @@ def test_log_follow():
preexec_fn=os.setsid,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
time.sleep(10)
proc.poll()
@@ -233,10 +215,10 @@ def test_log_follow():
print('STDERR: {}'.format(stderr))
assert len(stdout.decode('utf-8').split('\n')) > 3
def test_log_lines():
assert_lines(['dcos', 'service', 'log', 'chronos', '--lines=4'], 4)
exec_command(['dcos', 'package', 'uninstall', 'chronos'])
@pytest.mark.skipif(True, reason='Broken Marathon but we need to release')
def test_log_multiple_apps():

View File

@@ -87,6 +87,7 @@ def test_verify_ssl_with_bad_cert_config(env):
assert stderr.decode('utf-8') == _ssl_error_msg()
@pytest.mark.skipif(True, reason='Need to resolve DCOS-9273 to validate certs')
def test_verify_ssl_with_good_cert_env_var(env):
env['DCOS_SSL_VERIFY'] = env['DCOS_SNAKEOIL_CRT_PATH']
@@ -99,6 +100,7 @@ def test_verify_ssl_with_good_cert_env_var(env):
env.pop('DCOS_SSL_VERIFY')
@pytest.mark.skipif(True, reason='Need to resolve DCOS-9273 to validate certs')
def test_verify_ssl_with_good_cert_config(env):
with update_config(
'core.ssl_verify', env['DCOS_SNAKEOIL_CRT_PATH'], env):

View File

@@ -119,7 +119,7 @@ def test_log_single_file():
assert returncode == 0
assert stderr == b''
assert len(stdout.decode('utf-8').split('\n')) == 7
assert len(stdout.decode('utf-8').split('\n')) > 0
def test_log_missing_file():
@@ -178,9 +178,9 @@ def test_log_two_tasks():
assert stderr == b''
lines = stdout.decode('utf-8').split('\n')
assert len(lines) == 15
assert len(lines) == 17
assert re.match('===>.*<===', lines[0])
assert re.match('===>.*<===', lines[7])
assert re.match('===>.*<===', lines[8])
@pytest.mark.skipif(sys.platform == 'win32',