Merge pull request #184 from mesosphere/vagrant_tests
changed tests to work with dcos
This commit is contained in:
17
bin/start_tests.sh
Executable file
17
bin/start_tests.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# move the dcos package
|
||||
cd dcos-cli
|
||||
|
||||
make clean env
|
||||
source env/bin/activate
|
||||
make || exit $?
|
||||
deactivate
|
||||
|
||||
# Move down to the dcoscli package
|
||||
cd cli
|
||||
|
||||
make clean env
|
||||
source env/bin/activate
|
||||
make || exit $?
|
||||
deactivate
|
||||
@@ -1,9 +1,7 @@
|
||||
[core]
|
||||
mesos_master_url = "http://localhost:5050"
|
||||
reporting = false
|
||||
dcos_url = "http://localhost:5080"
|
||||
email = "test@mail.com"
|
||||
[marathon]
|
||||
url = "http://localhost:8080"
|
||||
reporting = false
|
||||
[package]
|
||||
sources = [ "git://github.com/mesosphere/universe.git", "https://github.com/mesosphere/universe/archive/master.zip",]
|
||||
cache = "tmp/cache"
|
||||
sources = [ "git://github.com/mesosphere/universe.git", "https://github.com/mesosphere/universe/archive/master.zip",]
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
reporting = false
|
||||
email = "test@mail.com"
|
||||
[package]
|
||||
sources = [ "git://github.com/mesosphere/universe.git", "https://github.com/mesosphere/universe/archive/master.zip",]
|
||||
cache = "true"
|
||||
sources = [ "git://github.com/mesosphere/universe.git", "https://github.com/mesosphere/universe/archive/master.zip",]
|
||||
|
||||
@@ -67,10 +67,9 @@ def test_version():
|
||||
|
||||
|
||||
def test_list_property(env):
|
||||
stdout = b"""core.email=test@mail.com
|
||||
core.mesos_master_url=http://localhost:5050
|
||||
stdout = b"""core.dcos_url=http://localhost:5080
|
||||
core.email=test@mail.com
|
||||
core.reporting=False
|
||||
marathon.url=http://localhost:8080
|
||||
package.cache=tmp/cache
|
||||
package.sources=['git://github.com/mesosphere/universe.git', \
|
||||
'https://github.com/mesosphere/universe/archive/master.zip']
|
||||
@@ -81,7 +80,7 @@ package.sources=['git://github.com/mesosphere/universe.git', \
|
||||
|
||||
|
||||
def test_get_existing_string_property(env):
|
||||
_get_value('marathon.url', 'http://localhost:8080', env)
|
||||
_get_value('core.dcos_url', 'http://localhost:5080', env)
|
||||
|
||||
|
||||
def test_get_existing_boolean_property(env):
|
||||
@@ -106,9 +105,9 @@ def test_get_top_property(env):
|
||||
|
||||
|
||||
def test_set_existing_string_property(env):
|
||||
_set_value('marathon.url', 'http://newhost:8081', env)
|
||||
_get_value('marathon.url', 'http://newhost:8081', env)
|
||||
_set_value('marathon.url', 'http://localhost:8080', env)
|
||||
_set_value('core.dcos_url', 'http://localhost:5081', env)
|
||||
_get_value('core.dcos_url', 'http://localhost:5081', env)
|
||||
_set_value('core.dcos_url', 'http://localhost:5080', env)
|
||||
|
||||
|
||||
def test_set_existing_boolean_property(env):
|
||||
@@ -188,22 +187,22 @@ def test_prepend_list(env):
|
||||
|
||||
|
||||
def test_append_non_list(env):
|
||||
stderr = (b"Append/Prepend not supported on 'marathon.url' "
|
||||
b"properties - use 'dcos config set marathon.url new_uri'\n")
|
||||
stderr = (b"Append/Prepend not supported on 'core.dcos_url' "
|
||||
b"properties - use 'dcos config set core.dcos_url new_uri'\n")
|
||||
|
||||
assert_command(
|
||||
['dcos', 'config', 'append', 'marathon.url', 'new_uri'],
|
||||
['dcos', 'config', 'append', 'core.dcos_url', 'new_uri'],
|
||||
returncode=1,
|
||||
stderr=stderr,
|
||||
env=env)
|
||||
|
||||
|
||||
def test_prepend_non_list(env):
|
||||
stderr = (b"Append/Prepend not supported on 'marathon.url' "
|
||||
b"properties - use 'dcos config set marathon.url new_uri'\n")
|
||||
stderr = (b"Append/Prepend not supported on 'core.dcos_url' "
|
||||
b"properties - use 'dcos config set core.dcos_url new_uri'\n")
|
||||
|
||||
assert_command(
|
||||
['dcos', 'config', 'prepend', 'marathon.url', 'new_uri'],
|
||||
['dcos', 'config', 'prepend', 'core.dcos_url', 'new_uri'],
|
||||
returncode=1,
|
||||
stderr=stderr,
|
||||
env=env)
|
||||
@@ -285,7 +284,7 @@ def test_unset_index_from_string(env):
|
||||
stderr = b'Unsetting based on an index is only supported for lists\n'
|
||||
|
||||
assert_command(
|
||||
['dcos', 'config', 'unset', '--index=0', 'marathon.url'],
|
||||
['dcos', 'config', 'unset', '--index=0', 'core.dcos_url'],
|
||||
returncode=1,
|
||||
stderr=stderr,
|
||||
env=env)
|
||||
@@ -319,9 +318,9 @@ def test_set_property_key(env):
|
||||
|
||||
|
||||
def test_set_missing_property(missing_env):
|
||||
_set_value('marathon.url', 'http://localhost:8080', missing_env)
|
||||
_get_value('marathon.url', 'http://localhost:8080', missing_env)
|
||||
_unset_value('marathon.url', None, missing_env)
|
||||
_set_value('core.dcos_url', 'http://localhost:8080', missing_env)
|
||||
_get_value('core.dcos_url', 'http://localhost:8080', missing_env)
|
||||
_unset_value('core.dcos_url', None, missing_env)
|
||||
|
||||
|
||||
def test_set_core_property(env):
|
||||
|
||||
@@ -604,9 +604,6 @@ def test_show_task():
|
||||
|
||||
|
||||
def test_bad_configuration():
|
||||
show_returncode, show_stdout, stderr = exec_command(
|
||||
['dcos', 'config', 'show', 'marathon.url'])
|
||||
|
||||
assert_command(
|
||||
['dcos', 'config', 'set', 'marathon.url', 'http://localhost:88888'])
|
||||
|
||||
@@ -619,11 +616,7 @@ def test_bad_configuration():
|
||||
"Marathon likely misconfigured. Please check your proxy or "
|
||||
"Marathon URI settings. See dcos config --help. ")
|
||||
|
||||
if show_returncode == 0:
|
||||
url = show_stdout.decode('utf-8').strip()
|
||||
assert_command(['dcos', 'config', 'set', 'marathon.url', url])
|
||||
else:
|
||||
assert_command(['dcos', 'config', 'unset', 'marathon.url'])
|
||||
assert_command(['dcos', 'config', 'unset', 'marathon.url'])
|
||||
|
||||
|
||||
def _list_apps(app_id=None):
|
||||
|
||||
@@ -572,7 +572,7 @@ def test_search():
|
||||
for registry in registries:
|
||||
# assert the number of packages is gte the number at the time
|
||||
# this test was written
|
||||
assert len(registry['packages']) >= 9
|
||||
assert len(registry['packages']) >= 8
|
||||
|
||||
assert returncode == 0
|
||||
assert stderr == b''
|
||||
|
||||
Reference in New Issue
Block a user