swift-dsvm: Enable more middlewares

Change-Id: I3cbbcd2ea9ced0923bee4a6b0783e4cf5e82e95b
This commit is contained in:
Tim Burke 2020-04-22 11:56:04 -07:00
parent c7fe823c0a
commit 9581254e66
5 changed files with 69 additions and 6 deletions

View File

@ -0,0 +1,54 @@
- name: Add more middlewares to pipeline
replace:
path: "/etc/swift/proxy-server.conf"
regexp: "cache listing_formats"
replace: "cache domain_remap etag-quoter listing_formats"
become: true
- name: Set domain_remap domain
ini_file:
path: /etc/swift/proxy-server.conf
section: filter:domain_remap
option: storage_domain
value: example.com
become: true
- name: Set storage_domain in test.conf
ini_file:
path: /etc/swift/test.conf
section: func_test
option: storage_domain
value: example.com
become: true
- name: Enable object versioning
ini_file:
path: /etc/swift/proxy-server.conf
section: filter:versioned_writes
option: allow_object_versioning
value: true
become: true
- name: Copy ring for Policy-1
copy:
remote_src: true
src: /etc/swift/object.ring.gz
dest: /etc/swift/object-1.ring.gz
become: true
- name: Add Policy-1 to swift.conf
ini_file:
path: /etc/swift/swift.conf
section: storage-policy:1
option: name
value: Policy-1
become: true
- name: Restart service to pick up config changes
command: systemctl restart devstack@s-{{ item }}.service
become: true
with_items:
- proxy
- account
- container
- object

View File

@ -1121,10 +1121,15 @@ def get_url_token(user_index, os_options):
auth_version=swift_test_auth_version,
os_options=os_options,
insecure=insecure)
return get_auth(swift_test_auth,
swift_test_user[user_index],
swift_test_key[user_index],
**authargs)
url, token = get_auth(swift_test_auth,
swift_test_user[user_index],
swift_test_key[user_index],
**authargs)
if six.PY2 and not isinstance(url, bytes):
url = url.encode('utf-8')
if six.PY2 and not isinstance(token, bytes):
token = token.encode('utf-8')
return url, token
def retry(func, *args, **kwargs):

View File

@ -225,6 +225,9 @@ class Connection(object):
@storage_url.setter
def storage_url(self, value):
if six.PY2 and not isinstance(value, bytes):
value = value.encode('utf-8')
url = urllib.parse.urlparse(value)
if url.scheme == 'http':

View File

@ -293,7 +293,7 @@ class TestObjectVersioning(TestObjectVersioningBase):
# swift_test_client's File API doesn't really allow for POSTing
# arbitrary headers, so...
def put(url, token, parsed, conn):
def post(url, token, parsed, conn):
conn.request('POST', '%s/%s/%s' % (parsed.path, container,
versioned_obj2.name),
'', {'X-Auth-Token': token,
@ -301,7 +301,7 @@ class TestObjectVersioning(TestObjectVersioningBase):
'X-Object-Meta-Color': 'red',
'X-Delete-After': '1'})
return tf.check_response(conn)
resp = tf.retry(put)
resp = tf.retry(post)
resp.read()
self.assertEqual(resp.status, 202)

View File

@ -7,3 +7,4 @@
bindep_dir: "{{ zuul_work_dir }}"
- test-setup
- ensure-tox
- dsvm-additional-middlewares