Add prefix to azure log upload
This is necessary for the role to return the correct log URL. Change-Id: Ifa2f259d09a9fe95653570edd7d9cb56ae739fbd
This commit is contained in:
parent
1b69121aa2
commit
10e4b03e62
@ -33,11 +33,19 @@ FIXTURE_DIR = os.path.join(os.path.dirname(__file__),
|
||||
'test-fixtures')
|
||||
|
||||
|
||||
class FakeContainerClient:
|
||||
def __init__(self, url):
|
||||
self.url = url
|
||||
|
||||
|
||||
class TestUpload(testtools.TestCase):
|
||||
|
||||
def test_upload_result(self):
|
||||
client = mock.Mock()
|
||||
uploader = Uploader(client=client, container="container")
|
||||
client.create_container.return_value = FakeContainerClient(
|
||||
'http://blob.example.com')
|
||||
uploader = Uploader(client=client, container="container",
|
||||
prefix="123")
|
||||
|
||||
# Get some test files to upload
|
||||
files = [
|
||||
@ -57,8 +65,9 @@ class TestUpload(testtools.TestCase):
|
||||
|
||||
upload_calls = uploader.client.get_blob_client.mock_calls
|
||||
self.assertIn(
|
||||
mock.call(container='container', blob='job-output.json'),
|
||||
mock.call(container='container', blob='123/job-output.json'),
|
||||
upload_calls)
|
||||
self.assertIn(
|
||||
mock.call(container='container', blob='inventory.yaml'),
|
||||
mock.call(container='container', blob='123/inventory.yaml'),
|
||||
upload_calls)
|
||||
self.assertEqual(uploader.url, 'http://blob.example.com/123')
|
||||
|
@ -92,7 +92,7 @@ class Uploader():
|
||||
|
||||
client.set_service_properties(cors=cors)
|
||||
|
||||
self.url = cc.url
|
||||
self.url = os.path.join(cc.url, self.prefix)
|
||||
|
||||
def upload(self, file_list):
|
||||
"""Spin up thread pool to upload to storage"""
|
||||
|
Loading…
Reference in New Issue
Block a user