Skip to content

Commit

Permalink
test: fix packaging tests to work with the latest version of DC/OS (#998
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Jesus E. Larios Murillo authored and tamarrow committed May 22, 2017
1 parent c5dee79 commit 8c8dcc0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 60 deletions.
2 changes: 1 addition & 1 deletion cli/tests/data/helloworld-v3-stub.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"containerPort": 80
}
],
"image": "mesosphere/universe-server:20170331T221320Z-cli-test-v3-helloworld-c3e49742c9",
"image": "mesosphere/universe-server:20170518T235510Z-cli-test-v3-helloworld-ca5778937b",
"network": "BRIDGE"
},
"type": "DOCKER"
Expand Down
3 changes: 0 additions & 3 deletions cli/tests/data/package/json/test_describe_app_options.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@
"instances": 1,
"labels": {
"DCOS_PACKAGE_FRAMEWORK_NAME": "marathon-user",
"DCOS_PACKAGE_IS_FRAMEWORK": "true",
"DCOS_PACKAGE_METADATA": "eyJwYWNrYWdpbmdWZXJzaW9uIjoiMy4wIiwibmFtZSI6Im1hcmF0aG9uIiwidmVyc2lvbiI6IjEuNC4xIiwibWFpbnRhaW5lciI6InN1cHBvcnRAbWVzb3NwaGVyZS5pbyIsImRlc2NyaXB0aW9uIjoiQSBjb250YWluZXIgb3JjaGVzdHJhdGlvbiBwbGF0Zm9ybSBmb3IgTWVzb3MgYW5kIERDT1MuIiwidGFncyI6WyJpbml0IiwibG9uZy1ydW5uaW5nIl0sInNlbGVjdGVkIjp0cnVlLCJzY20iOiJodHRwczovL2dpdGh1Yi5jb20vbWVzb3NwaGVyZS9tYXJhdGhvbi5naXQiLCJmcmFtZXdvcmsiOnRydWUsInByZUluc3RhbGxOb3RlcyI6IldlIHJlY29tbWVuZCBhIG1pbmltdW0gb2Ygb25lIG5vZGUgd2l0aCBhdCBsZWFzdCAyIENQVSBzaGFyZXMgYW5kIDFHQiBvZiBSQU0gYX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lLmNvbS9tYXJhdGhvbi9hc3NldHMvaWNvbi1zZXJ2aWNlLW1hcmF0aG9uLWxhcmdlLnBuZyJ9fQ==",
"DCOS_PACKAGE_NAME": "marathon",
"DCOS_PACKAGE_REGISTRY_VERSION": "3.0",
"DCOS_PACKAGE_RELEASE": "8",
"DCOS_PACKAGE_SOURCE": "http://universe.marathon.mesos:8085/repo",
"DCOS_PACKAGE_VERSION": "1.4.1",
"DCOS_SERVICE_NAME": "marathon-user",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@
"instances": 1,
"labels": {
"DCOS_PACKAGE_FRAMEWORK_NAME": "marathon-user",
"DCOS_PACKAGE_IS_FRAMEWORK": "true",
"DCOS_PACKAGE_METADATA": "eyJwYWNrYWdpbmdWZXJzaW9uIjoiMy4wIiwibmFtZSI6Im1hcmF0aG9uIiwidmVyc2lvbiI6IjEuNC4xIiwibWFpbnRhaW5lciI6InN1cHBvcnRAbWVzb3NwaGVyZS5pbyIsImRlc2NyaXB0aW9uIjoiQSBjb250YWluZXIgb3JjaGVzdHJhdGlvbiBwbGF0Zm9ybSBmb3IgTWVzb3MgYW5kIERDT1MuIiwidGFncyI6WyJpbml0IiwibG9uZy1ydW5uaW5nIl0sInNlbGVjdGVkIjp0cnVlLCJzY20iOiJodHRwczovL2dpdGh1Yi5jb20vbWVzb3NwaGVyZS9tYXJhdGhvbi5naXQiLCJmcmFtZXdvcmsiOnRydWUsInByZUluc3RhbGxOb3RlcyI6IldlIHJlY29tbWVuZCBhIG1pbmltdW0gb2Ygb25lIG5vZGUgd2l0aCBhdCBsZWFzdCAyIENQVSBzaGFyZXMgYW5kIDFHQiBvZiBSQU0gYXZhaWxhYmxlIGZvciB0aGUgTWFyYXRob24gRENPUyBTZXJ2aWNlLiIsInBvc3RJbnN0YWxsTm90ZXMiOiJNYXJhdGhvbiBEQ09TIFNlcnZpY2UgaGFzIGJlZW4gc3VjY2Vzc2Z1bGx5IGluc3RhbGxlZCFcblxuX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",
"DCOS_PACKAGE_SOURCE": "http://universe.marathon.mesos:8085/repo",
"DCOS_PACKAGE_VERSION": "1.4.1",
"DCOS_SERVICE_NAME": "marathon-user",
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/data/universe-v3-stub.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"containerPort": 80
}
],
"image": "mesosphere/universe-server:20170326T170201Z-version-3.x-34bf4c095b",
"image": "mesosphere/universe-server:20170519T000904Z-cli-version-3.x-snapshot-3a8823b60e",
"network": "BRIDGE"
},
"type": "DOCKER"
Expand Down
50 changes: 10 additions & 40 deletions cli/tests/integrations/test_experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def test_service_start_happy_path():
runnable_package = _package_build(
runnable_package_path(2), output_directory)
name, version = _package_add(runnable_package)
_wait_for_package_add_local(runnable_package)
try:
_service_start(name, version)
finally:
Expand All @@ -215,7 +214,6 @@ def test_service_start_happy_path_json():
runnable_package = _package_build(
runnable_package_path(3), output_directory)
name, version = _package_add(runnable_package, expects_json=True)
_wait_for_package_add_local(runnable_package)
try:
_service_start(name, version, expects_json=True)
finally:
Expand All @@ -225,7 +223,6 @@ def test_service_start_happy_path_json():
def test_service_start_happy_path_from_universe():
package_name = 'linkerd'
name, version = _package_add_universe(package_name)
_wait_for_package_add_remote(name, version)
try:
_service_start(name, version)
finally:
Expand All @@ -235,7 +232,6 @@ def test_service_start_happy_path_from_universe():
def test_service_start_happy_path_from_universe_json():
package_name = 'cassandra'
name, version = _package_add_universe(package_name, expects_json=True)
_wait_for_package_add_remote(name, version)
try:
_service_start(name, version)
finally:
Expand All @@ -244,7 +240,6 @@ def test_service_start_happy_path_from_universe_json():

def test_service_start_by_starting_same_service_twice():
name, version = _package_add_universe('kafka')
_wait_for_package_add_remote(name, version)
try:
_service_start(name, version)
stderr = b'The DC/OS service has already been started\n'
Expand Down Expand Up @@ -325,7 +320,16 @@ def _service_start(package_name,
package_version,
options,
json=expects_json)
code, out, err = exec_command(command)
code = 1
max_retries = 10
retry_number = 0
while code != 0:
code, out, err = exec_command(command)
assert retry_number != max_retries, \
'Waiting for package add to complete took too long'
retry_number += 1
time.sleep(5)

assert code == 0
assert err == b''

Expand Down Expand Up @@ -460,40 +464,6 @@ def _package_build_failure(build_definition_path,
assert len(os.listdir(output_directory)) == 0


def _wait_for_package_add_remote(package_name, package_version):
command = _package_add_cmd(package_name=package_name,
package_version=package_version)
_wait_for_package_add(command, package_name, package_version)


def _wait_for_package_add_local(package):
command = _package_add_cmd(dcos_package=package)
metadata = zip_contents_as_json(package, 'metadata.json')
name = metadata['name']
version = metadata['version']
_wait_for_package_add(command, name, version)


def _wait_for_package_add(command, name, version):
done_adding = False
max_retries = 10
retry_number = 0
while not done_adding:
code, out, err = exec_command(command)
change_in_progress_message = (
'A change to package '
'{}-{} is already in progress\n'.format(
name, version).encode())
done_adding = code == 0
assert (done_adding or
(code == 1 and
err == change_in_progress_message))
assert retry_number != max_retries, \
'Waiting for package add to complete took too long'
retry_number += 1
time.sleep(5)


def _successful_package_build_test(
build_definition_path,
expected_package_path=os.path.join(
Expand Down
12 changes: 0 additions & 12 deletions cli/tests/integrations/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,25 +417,15 @@ def test_package_metadata():
'postInstallNotes': 'A sample post-installation message'
}

expected_command = {
'pip': [
'dcos<1.0',
'git+https://github.com/mesosphere/' +
'dcos-helloworld.git#dcos-helloworld=0.1.0'
]
}

expected_source = bytes(
UNIVERSE_TEST_REPOS['helloworld-universe'],
'utf-8'
)

expected_labels = {
'DCOS_PACKAGE_REGISTRY_VERSION': b'3.0',
'DCOS_PACKAGE_NAME': b'helloworld',
'DCOS_PACKAGE_VERSION': b'0.1.0',
'DCOS_PACKAGE_SOURCE': expected_source,
'DCOS_PACKAGE_RELEASE': b'0',
}

app_labels = _get_app_labels('helloworld')
Expand All @@ -444,8 +434,6 @@ def test_package_metadata():

assert expected_metadata == base64_to_dict(six.b(
app_labels.get('DCOS_PACKAGE_METADATA')))
assert expected_command == base64_to_dict(six.b(
app_labels.get('DCOS_PACKAGE_COMMAND')))

# test local package.json
package = {
Expand Down

0 comments on commit 8c8dcc0

Please sign in to comment.