summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2018-01-09 23:53:56 +0000
committerTim Burke <tim.burke@gmail.com>2018-01-09 16:10:03 -0800
commitb451ceed4bc9cdbfa591e36cde6c43579839c5ec (patch)
tree03adefb9f4e0c085ad48be643005b7b8ed638aa2
parentb0242f4fdc7d77b6c328ead519310d9ebb85f193 (diff)
downloadswift-b451ceed4bc9cdbfa591e36cde6c43579839c5ec.tar.gz
Add pipeline modification test for previously-recommended pipelines
This includes every pipeline from etc/proxy-server.conf-sample since we switched from swauth to tempauth in 1.4.1. As much as anything, I view this as a canary for auto-insertion changes, so we can (somewhat easily) see where new middlewares will be placed when upgrading from old swifts. Change-Id: I117937ab6ce28f3bc219e809f07b563c45fc486f Related-Change: I88678fddc7a25b0f065b33eb26047321d0db4d38
-rw-r--r--test/unit/common/test_wsgi.py164
1 files changed, 164 insertions, 0 deletions
diff --git a/test/unit/common/test_wsgi.py b/test/unit/common/test_wsgi.py
index 7750e138c..073dbe012 100644
--- a/test/unit/common/test_wsgi.py
+++ b/test/unit/common/test_wsgi.py
@@ -1611,6 +1611,170 @@ class TestPipelineModification(unittest.TestCase):
'swift.common.middleware.healthcheck',
'swift.proxy.server'])
+ def test_proxy_modify_wsgi_pipeline_recommended_pipelines(self):
+ to_test = [
+ # Version, filter-only pipeline, expected final pipeline
+ ('1.4.1',
+ 'catch_errors healthcheck cache ratelimit tempauth',
+ 'catch_errors gatekeeper healthcheck memcache'
+ ' listing_formats ratelimit tempauth copy dlo versioned_writes'),
+ ('1.5.0',
+ 'catch_errors healthcheck cache ratelimit tempauth proxy-logging',
+ 'catch_errors gatekeeper healthcheck memcache ratelimit tempauth'
+ ' proxy_logging listing_formats copy dlo versioned_writes'),
+ ('1.8.0',
+ 'catch_errors healthcheck proxy-logging cache slo ratelimit'
+ ' tempauth container-quotas account-quotas proxy-logging',
+ 'catch_errors gatekeeper healthcheck proxy_logging memcache'
+ ' listing_formats slo ratelimit tempauth copy dlo'
+ ' versioned_writes container_quotas account_quotas'
+ ' proxy_logging'),
+ ('1.9.1',
+ 'catch_errors healthcheck proxy-logging cache bulk slo ratelimit'
+ ' tempauth container-quotas account-quotas proxy-logging',
+ 'catch_errors gatekeeper healthcheck proxy_logging memcache'
+ ' listing_formats bulk slo ratelimit tempauth copy dlo'
+ ' versioned_writes container_quotas account_quotas'
+ ' proxy_logging'),
+ ('1.12.0',
+ 'catch_errors gatekeeper healthcheck proxy-logging cache'
+ ' container_sync bulk slo ratelimit tempauth container-quotas'
+ ' account-quotas proxy-logging',
+ 'catch_errors gatekeeper healthcheck proxy_logging memcache'
+ ' listing_formats container_sync bulk slo ratelimit tempauth'
+ ' copy dlo versioned_writes container_quotas account_quotas'
+ ' proxy_logging'),
+ ('1.13.0',
+ 'catch_errors gatekeeper healthcheck proxy-logging cache'
+ ' container_sync bulk slo dlo ratelimit tempauth'
+ ' container-quotas account-quotas proxy-logging',
+ 'catch_errors gatekeeper healthcheck proxy_logging memcache'
+ ' listing_formats container_sync bulk slo dlo ratelimit'
+ ' tempauth copy versioned_writes container_quotas account_quotas'
+ ' proxy_logging'),
+ ('1.13.1',
+ 'catch_errors gatekeeper healthcheck proxy-logging cache'
+ ' container_sync bulk tempurl slo dlo ratelimit tempauth'
+ ' container-quotas account-quotas proxy-logging',
+ 'catch_errors gatekeeper healthcheck proxy_logging memcache'
+ ' listing_formats container_sync bulk tempurl slo dlo ratelimit'
+ ' tempauth copy versioned_writes container_quotas account_quotas'
+ ' proxy_logging'),
+ ('2.0.0',
+ 'catch_errors gatekeeper healthcheck proxy-logging cache'
+ ' container_sync bulk tempurl ratelimit tempauth container-quotas'
+ ' account-quotas slo dlo proxy-logging',
+ 'catch_errors gatekeeper healthcheck proxy_logging memcache'
+ ' listing_formats container_sync bulk tempurl ratelimit tempauth'
+ ' copy container_quotas account_quotas slo dlo versioned_writes'
+ ' proxy_logging'),
+ ('2.4.0',
+ 'catch_errors gatekeeper healthcheck proxy-logging cache'
+ ' container_sync bulk tempurl ratelimit tempauth container-quotas'
+ ' account-quotas slo dlo versioned_writes proxy-logging',
+ 'catch_errors gatekeeper healthcheck proxy_logging memcache'
+ ' listing_formats container_sync bulk tempurl ratelimit tempauth'
+ ' copy container_quotas account_quotas slo dlo versioned_writes'
+ ' proxy_logging'),
+ ('2.8.0',
+ 'catch_errors gatekeeper healthcheck proxy-logging cache'
+ ' container_sync bulk tempurl ratelimit tempauth copy'
+ ' container-quotas account-quotas slo dlo versioned_writes'
+ ' proxy-logging',
+ 'catch_errors gatekeeper healthcheck proxy_logging memcache'
+ ' listing_formats container_sync bulk tempurl ratelimit tempauth'
+ ' copy container_quotas account_quotas slo dlo versioned_writes'
+ ' proxy_logging'),
+ ('2.16.0',
+ 'catch_errors gatekeeper healthcheck proxy-logging cache'
+ ' listing_formats container_sync bulk tempurl ratelimit'
+ ' tempauth copy container-quotas account-quotas slo dlo'
+ ' versioned_writes proxy-logging',
+ 'catch_errors gatekeeper healthcheck proxy_logging memcache'
+ ' listing_formats container_sync bulk tempurl ratelimit'
+ ' tempauth copy container_quotas account_quotas slo dlo'
+ ' versioned_writes proxy_logging'),
+ ]
+
+ config = """
+ [DEFAULT]
+ swift_dir = %s
+
+ [pipeline:main]
+ pipeline = %s proxy-server
+
+ [app:proxy-server]
+ use = egg:swift#proxy
+ conn_timeout = 0.2
+
+ [filter:catch_errors]
+ use = egg:swift#catch_errors
+
+ [filter:gatekeeper]
+ use = egg:swift#gatekeeper
+
+ [filter:healthcheck]
+ use = egg:swift#healthcheck
+
+ [filter:proxy-logging]
+ use = egg:swift#proxy_logging
+
+ [filter:cache]
+ use = egg:swift#memcache
+
+ [filter:listing_formats]
+ use = egg:swift#listing_formats
+
+ [filter:container_sync]
+ use = egg:swift#container_sync
+
+ [filter:bulk]
+ use = egg:swift#bulk
+
+ [filter:tempurl]
+ use = egg:swift#tempurl
+
+ [filter:ratelimit]
+ use = egg:swift#ratelimit
+
+ [filter:tempauth]
+ use = egg:swift#tempauth
+
+ [filter:copy]
+ use = egg:swift#copy
+
+ [filter:container-quotas]
+ use = egg:swift#container_quotas
+
+ [filter:account-quotas]
+ use = egg:swift#account_quotas
+
+ [filter:slo]
+ use = egg:swift#slo
+
+ [filter:dlo]
+ use = egg:swift#dlo
+
+ [filter:versioned_writes]
+ use = egg:swift#versioned_writes
+ """
+ contents = dedent(config)
+
+ with temptree(['proxy-server.conf']) as t:
+ _fake_rings(t)
+ for version, pipeline, expected in to_test:
+ conf_file = os.path.join(t, 'proxy-server.conf')
+ with open(conf_file, 'w') as f:
+ f.write(contents % (t, pipeline))
+ app = wsgi.loadapp(conf_file, global_conf={})
+
+ actual = ' '.join(m.rsplit('.', 1)[1]
+ for m in self.pipeline_modules(app)[:-1])
+ self.assertEqual(
+ expected, actual,
+ 'Pipeline mismatch for version %s: got\n %s\n'
+ 'but expected\n %s' % (version, actual, expected))
+
def test_proxy_modify_wsgi_pipeline_inserts_versioned_writes(self):
config = """
[DEFAULT]