From 87af703ffcf1985266169b03988e965d62b2b0a7 Mon Sep 17 00:00:00 2001 From: Thomas Herve Date: Thu, 23 Jun 2016 14:13:01 +0200 Subject: [PATCH] Cleanup integration tests setup At some point integrations tests were supposed to be run against an existing Zaqar server, but this doesn't work anymore and is not tested anywhere. Let's remove the configuration and the setup for it. Change-Id: I44cd22366e52853ebc06b6089d33d9e0dd7ed08f --- tox.ini | 4 ++-- zaqar/tests/etc/functional-tests.conf | 7 ------ zaqar/tests/functional/base.py | 17 ++++---------- zaqar/tests/functional/config.py | 9 -------- zaqar/tests/functional/helpers.py | 22 ------------------- zaqar/tests/functional/wsgi/v1/test_queues.py | 21 ------------------ .../tests/functional/wsgi/v1_1/test_queues.py | 21 ------------------ 7 files changed, 6 insertions(+), 95 deletions(-) diff --git a/tox.ini b/tox.ini index d5ea72226..1a8a2d7dd 100644 --- a/tox.ini +++ b/tox.ini @@ -25,7 +25,7 @@ setenv = {[testenv]setenv} setenv = {[testenv]setenv} ZAQAR_TEST_INTEGRATION=1 OS_TEST_PATH=./zaqar/tests/functional -commands = python setup.py testr --slowest --testr-args='--concurrency 1' +commands = python setup.py testr --slowest --testr-args='--concurrency 1 {posargs}' [testenv:pep8] commands = flake8 @@ -86,4 +86,4 @@ import_exceptions = zaqar.openstack.common.gettextutils._,zaqar.i18n._ # upstream infra does not yet support it. Once that's fixed, we can # drop the install_command. install_command = pip install -U --force-reinstall {opts} {packages} -commands = sphinx-build -a -E -W -d install-guide/build/doctrees -b html install-guide/source install-guide/build/html \ No newline at end of file +commands = sphinx-build -a -E -W -d install-guide/build/doctrees -b html install-guide/source install-guide/build/html diff --git a/zaqar/tests/etc/functional-tests.conf b/zaqar/tests/etc/functional-tests.conf index c19d7dcf7..38d8dc66b 100644 --- a/zaqar/tests/etc/functional-tests.conf +++ b/zaqar/tests/etc/functional-tests.conf @@ -2,14 +2,7 @@ # run_tests = True unreliable = True -[auth] -# auth_on = False -# url = https://127.0.0.1:5000/v2.0/tokens -# username = None -# password = None - [zaqar] -# run_server = True # url = http://0.0.0.0:8888 # config = functional-zaqar.conf diff --git a/zaqar/tests/functional/base.py b/zaqar/tests/functional/base.py index e8c7a5680..a9fc4305c 100644 --- a/zaqar/tests/functional/base.py +++ b/zaqar/tests/functional/base.py @@ -95,15 +95,10 @@ class FunctionalTestBase(testing.TestBase): self.__class__.class_ttl_gc_interval = 60 if _TEST_INTEGRATION: - # TODO(kgriffs): This code should be replaced to use - # an external wsgi server instance. - - # NOTE(flaper87): Use running instances. - if self.cfg.zaqar.run_server: - if not (self.server and self.server.is_alive()): - self.server = self.server_class() - self.server.start(self.mconf) - self.addCleanup(self.server.process.terminate) + if not (self.server and self.server.is_alive()): + self.server = self.server_class() + self.server.start(self.mconf) + self.addCleanup(self.server.process.terminate) self.client = http.Client() else: @@ -117,10 +112,6 @@ class FunctionalTestBase(testing.TestBase): self.headers = helpers.create_zaqar_headers(self.cfg) - if self.cfg.auth.auth_on: - auth_token = helpers.get_keystone_token(self.cfg, self.client) - self.headers["X-Auth-Token"] = auth_token - self.headers_response_with_body = {'location', 'content-type'} self.client.set_headers(self.headers) diff --git a/zaqar/tests/functional/config.py b/zaqar/tests/functional/config.py index db19ee3d9..db32bec04 100644 --- a/zaqar/tests/functional/config.py +++ b/zaqar/tests/functional/config.py @@ -23,16 +23,8 @@ _DEFAULT = ( cfg.BoolOpt("run_tests", default=True), ) -_AUTH_OPTIONS = ( - cfg.BoolOpt("auth_on", default=False), - cfg.StrOpt("url", default="https://127.0.0.1:5000/v2.0/tokens"), - cfg.StrOpt("username"), - cfg.StrOpt("password"), -) - _ZAQAR_OPTIONS = ( - cfg.BoolOpt("run_server", default=True), cfg.StrOpt("url", default="http://127.0.0.1:8888"), cfg.StrOpt("config", default="functional-zaqar.conf"), ) @@ -47,7 +39,6 @@ _HEADERS_OPTIONS = ( def load_config(): conf = cfg.ConfigOpts() conf.register_opts(_DEFAULT) - conf.register_opts(_AUTH_OPTIONS, group="auth") conf.register_opts(_ZAQAR_OPTIONS, group="zaqar") conf.register_opts(_HEADERS_OPTIONS, group="headers") diff --git a/zaqar/tests/functional/helpers.py b/zaqar/tests/functional/helpers.py index 2e4dd1788..b357d9f3b 100644 --- a/zaqar/tests/functional/helpers.py +++ b/zaqar/tests/functional/helpers.py @@ -18,28 +18,6 @@ import string import uuid -def get_keystone_token(conf, client): - """Gets Keystone Auth token.""" - body = { - 'auth': { - 'passwordCredentials': { - 'username': conf.auth.username, - 'password': conf.auth.password - }, - }, - } - - header = {"Content-Type": "application/json", - "Accept": "application/json"} - - response = client.post(url=conf.auth.url, - headers=header, - data=body) - - response_body = response.json() - return response_body['access']['token']['id'] - - def create_zaqar_headers(conf): """Returns headers to be used for all Zaqar requests.""" diff --git a/zaqar/tests/functional/wsgi/v1/test_queues.py b/zaqar/tests/functional/wsgi/v1/test_queues.py index 10a07b775..50a0f7726 100644 --- a/zaqar/tests/functional/wsgi/v1/test_queues.py +++ b/zaqar/tests/functional/wsgi/v1/test_queues.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import copy import uuid import ddt @@ -125,26 +124,6 @@ class TestInsertQueue(base.V1FunctionalTestBase): test_insert_queue_invalid_name.tags = ['negative'] - def test_insert_queue_invalid_authtoken(self): - """Insert Queue with invalid authtoken.""" - - # NOTE(flaper87): Currently, tearDown - # depends on this attribute. Needs to - # be fixed. - self.url = self.base_url + '/queues/invalidauthtoken' - self.addCleanup(self.client.delete, self.url) - - if not self.cfg.auth.auth_on: - self.skipTest("Auth is not on!") - - header = copy.copy(self.header) - header['X-Auth-Token'] = 'invalid' - - result = self.client.put(self.url, headers=header) - self.assertEqual(401, result.status_code) - - test_insert_queue_invalid_authtoken.tags = ['negative'] - def test_insert_queue_header_plaintext(self): """Insert Queue with 'Accept': 'plain/text'.""" path = '/queues/plaintextheader' diff --git a/zaqar/tests/functional/wsgi/v1_1/test_queues.py b/zaqar/tests/functional/wsgi/v1_1/test_queues.py index 5f984e562..fa418787f 100644 --- a/zaqar/tests/functional/wsgi/v1_1/test_queues.py +++ b/zaqar/tests/functional/wsgi/v1_1/test_queues.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import copy import uuid import ddt @@ -116,26 +115,6 @@ class TestInsertQueue(base.V1_1FunctionalTestBase): test_insert_queue_invalid_name.tags = ['negative'] - def test_insert_queue_invalid_authtoken(self): - """Insert Queue with invalid authtoken.""" - - # NOTE(flaper87): Currently, tearDown - # depends on this attribute. Needs to - # be fixed. - self.url = self.base_url + '/queues/invalidauthtoken' - self.addCleanup(self.client.delete, self.url) - - if not self.cfg.auth.auth_on: - self.skipTest("Auth is not on!") - - header = copy.copy(self.header) - header['X-Auth-Token'] = 'invalid' - - result = self.client.put(self.url, headers=header) - self.assertEqual(401, result.status_code) - - test_insert_queue_invalid_authtoken.tags = ['negative'] - def test_insert_queue_header_plaintext(self): """Insert Queue with 'Accept': 'plain/text'.""" path = '/queues/plaintextheader'