Merge "Add pipeline modification test for previously-recommended pipelines"

This commit is contained in:
Zuul 2018-01-24 11:14:58 +00:00 committed by Gerrit Code Review
commit 5cf96230c8

View File

@ -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]