diff --git a/roles/dsvm-additional-middlewares/tasks/main.yaml b/roles/dsvm-additional-middlewares/tasks/main.yaml new file mode 100644 index 0000000000..f149e519f6 --- /dev/null +++ b/roles/dsvm-additional-middlewares/tasks/main.yaml @@ -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 diff --git a/test/functional/__init__.py b/test/functional/__init__.py index 37b0931310..b144969352 100644 --- a/test/functional/__init__.py +++ b/test/functional/__init__.py @@ -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): diff --git a/test/functional/swift_test_client.py b/test/functional/swift_test_client.py index 8cac6b1b3a..b5ae465612 100644 --- a/test/functional/swift_test_client.py +++ b/test/functional/swift_test_client.py @@ -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': diff --git a/test/functional/test_object_versioning.py b/test/functional/test_object_versioning.py index cfb21d284b..ebfca68f60 100644 --- a/test/functional/test_object_versioning.py +++ b/test/functional/test_object_versioning.py @@ -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) diff --git a/tools/playbooks/dsvm/pre.yaml b/tools/playbooks/dsvm/pre.yaml index 3a089d1761..351e28097f 100644 --- a/tools/playbooks/dsvm/pre.yaml +++ b/tools/playbooks/dsvm/pre.yaml @@ -7,3 +7,4 @@ bindep_dir: "{{ zuul_work_dir }}" - test-setup - ensure-tox + - dsvm-additional-middlewares