From 37e8dedac27a4567c02c78c4fb7d45b1d50e717c Mon Sep 17 00:00:00 2001 From: Lingxian Kong Date: Thu, 6 Jun 2019 15:57:21 +1200 Subject: [PATCH] Remove the trove-tox-apiexamples CI job - The job relies on python-troveclient, sometimes python-troveclient only changes the URL sending to Trove but neither request nor response. - The job is hard to maintain, especially when there are changes relating the API. The recommended way is to manually update the API doc and add tests in trove-tox-fakemodetests job. - Remove that trovestack subcommand as well. Change-Id: I108203915ef79ef93bbfbb15acdb7480854878e0 --- .zuul.yaml | 12 - integration/scripts/trovestack | 26 - integration/tests/examples/README | 13 - integration/tests/examples/example_gen.sh | 4 - integration/tests/examples/examples/client.py | 232 ---- .../examples/examples/example_generation.py | 1049 ----------------- .../tests/examples/examples/local.conf | 10 - integration/tests/examples/gendoc.sh | 8 - integration/tests/examples/local.conf | 10 - integration/tests/examples/setup.py | 30 - integration/tests/examples/tox.ini | 16 - tox.ini | 6 +- 12 files changed, 1 insertion(+), 1415 deletions(-) delete mode 100644 integration/tests/examples/README delete mode 100755 integration/tests/examples/example_gen.sh delete mode 100644 integration/tests/examples/examples/client.py delete mode 100644 integration/tests/examples/examples/example_generation.py delete mode 100644 integration/tests/examples/examples/local.conf delete mode 100755 integration/tests/examples/gendoc.sh delete mode 100644 integration/tests/examples/local.conf delete mode 100644 integration/tests/examples/setup.py delete mode 100644 integration/tests/examples/tox.ini diff --git a/.zuul.yaml b/.zuul.yaml index e4a1d2a327..398ac5682a 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -34,7 +34,6 @@ - trove-scenario-redis-multi: voting: false - trove-tox-fakemodetests - - trove-tox-apiexamples - trove-tox-bandit-baseline: voting: false - openstack-tox-pylint @@ -45,7 +44,6 @@ - trove-scenario-mysql-single - trove-scenario-mysql-multi - trove-tox-fakemodetests - - trove-tox-apiexamples - openstack-tox-pylint experimental: jobs: @@ -74,7 +72,6 @@ irrelevant-files: - ^.*\.rst$ - ^api-ref/.*$ - - ^apidocs/.*$ - ^doc/.*$ - ^releasenotes/.*$ - ^tools/.*$ @@ -114,7 +111,6 @@ irrelevant-files: - ^.*\.rst$ - ^api-ref/.*$ - - ^apidocs/.*$ - ^doc/.*$ - ^releasenotes/.*$ - ^tools/.*$ @@ -128,7 +124,6 @@ irrelevant-files: - ^.*\.rst$ - ^api-ref/.*$ - - ^apidocs/.*$ - ^contrib/.*$ - ^doc/.*$ - ^releasenotes/.*$ @@ -323,12 +318,6 @@ vars: tox_envlist: fakemodetests -- job: - name: trove-tox-apiexamples - parent: trove-fakemodetests-base - vars: - tox_envlist: apiexamples - - job: name: trove-tox-bandit-baseline parent: openstack-tox @@ -341,7 +330,6 @@ - ^.*\.rst$ - ^.*\.txt$ - ^api-ref/.*$ - - ^apidocs/.*$ - ^contrib/.*$ - ^doc/.*$ - ^etc/.*$ diff --git a/integration/scripts/trovestack b/integration/scripts/trovestack index 09c0f175dc..fba30b36ef 100755 --- a/integration/scripts/trovestack +++ b/integration/scripts/trovestack @@ -1070,31 +1070,6 @@ function cmd_int_tests_white_box() { --nova-flags=/etc/nova/nova.conf $@ } -function cmd_example_tests() { - set +e - cmd_stop - set -e - cmd_start_fake - sleep 3 - echo " -{ - \"directory\": \"$TROVESTACK_TESTS/../apidocs/src/resources/samples/\", - \"auth_url\":\"http://$KEYSTONE_AUTH_HOST/identity/v2.0/tokens\", - \"api_url\":\"http://$SERVICE_HOST:8779\", - \"replace_host\":\"https://ord.databases.api.rackspacecloud.com\", - \"replace_dns_hostname\": \"e09ad9a3f73309469cf1f43d11e79549caf9acf2.rackspaceclouddb.com\", - \"username\":\"examples\", - \"password\":\"examples\", - \"tenant\":\"trove\" -}" > /tmp/example-tests.conf - python $TROVESTACK_TESTS/examples/examples/example_generation.py /tmp/example-tests.conf - pushd $TROVESTACK_TESTS/../apidocs - mvn clean - mvn generate-sources - popd - cmd_stop -} - ############################################################################### # Misc. tools @@ -1545,7 +1520,6 @@ function run_command() { $TROVESTACK_SCRIPTS/image-projects-list;; "reset-task" ) shift; cmd_reset_task $@;; "wipe-queues" ) shift; cmd_wipe_queues $@;; - "example-tests" ) shift; cmd_example_tests $@;; "repl" ) shift; cmd_repl $@;; "help" ) print_usage;; * ) diff --git a/integration/tests/examples/README b/integration/tests/examples/README deleted file mode 100644 index f7ebb0b87c..0000000000 --- a/integration/tests/examples/README +++ /dev/null @@ -1,13 +0,0 @@ -Example Generator - -Settings for the example generator are in examples/local.conf - -After customizing examples/local.conf, run: -./example_gen.sh - -2012-06-12 - - Updated to work with trove - - All XML calls are commented out - - Management calls are also commented out -2012-06-14 - - Renabled XML calls diff --git a/integration/tests/examples/example_gen.sh b/integration/tests/examples/example_gen.sh deleted file mode 100755 index cbbe153fa3..0000000000 --- a/integration/tests/examples/example_gen.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -python ./examples/example_generation.py ./examples/local.conf - diff --git a/integration/tests/examples/examples/client.py b/integration/tests/examples/examples/client.py deleted file mode 100644 index 4b18b0a7a7..0000000000 --- a/integration/tests/examples/examples/client.py +++ /dev/null @@ -1,232 +0,0 @@ -import json -import os -import re -from six.moves.urllib.parse import urlparse -import xml.dom.minidom - -from proboscis.asserts import * -from troveclient.compat.client import TroveHTTPClient -from troveclient.compat.xml import TroveXmlClient - - -print_req = True - - -class ConfigFile(object): - - def __init__(self, config_file): - if not os.path.exists(config_file): - raise RuntimeError("Could not find Example CONF at %s." % - config_file) - file_contents = open(config_file, "r").read() - try: - config = json.loads(file_contents) - except Exception as exception: - msg = 'Error loading config file "%s".' % config_file - raise RuntimeError(msg, exception) - - self.directory = config.get("directory", None) - if not self.directory.endswith('/'): - self.directory += '/' - self.api_url = config.get("api_url", None) - self.auth_url = config.get("auth_url", None) - self.username = config.get("username", None) - self.password = config.get("password", None) - self.tenant = config.get("tenant", None) - self.replace_host = config.get("replace_host", None) - self.replace_dns_hostname = config.get("replace_dns_hostname", None) - if self.auth_url: - auth_id, tenant_id = self.get_auth_token_id_tenant_id(self.auth_url, - self.username, - self.password) - else: - auth_id = self.tenant - tenant_id = self.tenant - - print("id = %s" % auth_id) - self.headers = { - 'X-Auth-Token': str(auth_id) - } - print("tenantID = %s" % tenant_id) - self.tenantID = tenant_id - self.dbaas_url = "%s/v1.0/%s" % (self.api_url, self.tenantID) - - -def shorten_url(url): - parsed = urlparse(url) - if parsed.query: - method_url = parsed.path + '?' + parsed.query - else: - method_url = parsed.path - return method_url - - -class SnippetWriter(object): - - def __init__(self, conf): - self.conf = conf - - def _indent_xml(self, my_string): - my_string = my_string.encode("utf-8") - # convert to plain string without indents and spaces - my_re = re.compile(r'>\s+([^\s])', re.DOTALL) - my_string = myre.sub(r'>\g<1>', my_string) - my_string = xml.dom.minidom.parseString(my_string).toprettyxml() - # remove line breaks - my_re = re.compile(r'>\n\s+([^<>\s].*?)\n\s+\g<1>\s+([^\s])', re.DOTALL) - my_string = myre.sub(r'>\g<1>', my_string) - my_string = xml.dom.minidom.parseString(my_string).toprettyxml() - # remove line breaks - my_re = re.compile(r'>\n\s+([^<>\s].*?)\n\s+\g<1>