Browse Source

Merge "py3: Fix up probe tests"

changes/74/708274/1
Zuul Gerrit Code Review 1 week ago
parent
commit
5403ae2f98
2 changed files with 9 additions and 8 deletions
  1. +4
    -4
      test/probe/brain.py
  2. +5
    -4
      test/probe/test_container_merge_policy_index.py

+ 4
- 4
test/probe/brain.py View File

@@ -14,13 +14,13 @@
from __future__ import print_function
import functools
import sys
from io import BytesIO
import itertools
import uuid
from optparse import OptionParser
import random

import six
from six import StringIO
from six.moves.urllib.parse import urlparse, parse_qs, quote

from swift.common.manager import Manager
@@ -233,7 +233,7 @@ def translate_client_exception(m):
return m(*args, **kwargs)
except UnexpectedResponse as err:
raise ClientException(
err.message,
err.args[0],
http_scheme=err.resp.environ['wsgi.url_scheme'],
http_host=err.resp.environ['SERVER_NAME'],
http_port=err.resp.environ['SERVER_PORT'],
@@ -274,7 +274,7 @@ class InternalBrainClient(object):
@translate_client_exception
def put_object(self, container_name, object_name, headers, contents,
query_string=None):
return self.swift.upload_object(StringIO(contents), self.account,
return self.swift.upload_object(BytesIO(contents), self.account,
container_name, object_name,
headers=headers,
params=self.parse_qs(query_string))
@@ -294,7 +294,7 @@ class InternalBrainClient(object):
status, headers, resp_iter = self.swift.get_object(
self.account, container_name, object_name,
params=self.parse_qs(query_string))
return headers, ''.join(resp_iter)
return headers, b''.join(resp_iter)


@six.add_metaclass(meta_command)


+ 5
- 4
test/probe/test_container_merge_policy_index.py View File

@@ -358,9 +358,10 @@ class TestContainerMergePolicyIndex(ReplProbeTest):
for i in range(20)))

# and regular upload should work now too
self.brain.client.put_object(self.container_name, self.object_name, {},
utils.json.dumps(manifest_data),
query_string='multipart-manifest=put')
self.brain.client.put_object(
self.container_name, self.object_name, {},
utils.json.dumps(manifest_data).encode('ascii'),
query_string='multipart-manifest=put')
metadata = self.brain.client.head_object(self.container_name,
self.object_name)
self.assertEqual(int(metadata['content-length']),
@@ -392,7 +393,7 @@ class TestContainerMergePolicyIndex(ReplProbeTest):
'X-Symlink-Target': '%s/%s' % (
self.container_name, target_name),
'Content-Type': 'application/symlink',
}, '')
}, b'')

# at this point we have a broken symlink (the container_info has the
# proxy looking for the target in the wrong policy)


Loading…
Cancel
Save