Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for generating CLI commands to object_storage service.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=288604096
- Loading branch information
1 parent
91c86be
commit aa1f667
Showing
8 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Tests for perfkitbenchmarker.providers.openstack.swift.""" | ||
|
||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
import os | ||
import unittest | ||
import mock | ||
from perfkitbenchmarker import vm_util | ||
from perfkitbenchmarker.providers.openstack import swift | ||
|
||
|
||
class SwiftTest(unittest.TestCase): | ||
|
||
def setUp(self): | ||
super(SwiftTest, self).setUp() | ||
p = mock.patch(swift.__name__ + '.FLAGS') | ||
self.mock_flags = p.start() | ||
self.addCleanup(p.stop) | ||
self.mock_flags.openstack_swift_insecure = False | ||
|
||
@mock.patch.dict(os.environ, {'OS_AUTH_URL': 'OS_AUTH_URL', | ||
'OS_TENANT_NAME': 'OS_TENANT_NAME', | ||
'OS_USERNAME': 'OS_USERNAME', | ||
'OS_PASSWORD': 'OS_PASSWORD'}) | ||
def testMakeBucket(self): | ||
swift_storage_service = swift.SwiftStorageService() | ||
swift_storage_service.PrepareService('location') | ||
|
||
with mock.patch(vm_util.__name__ + '.IssueCommand', | ||
return_value=('stdout', 'stderr', 0)) as mock_util: | ||
swift_storage_service.MakeBucket('new_bucket') | ||
mock_util.assert_called_with(['swift', | ||
'--os-auth-url', 'OS_AUTH_URL', | ||
'--os-tenant-name', 'OS_TENANT_NAME', | ||
'--os-username', 'OS_USERNAME', | ||
'--os-password', 'OS_PASSWORD', | ||
'post', | ||
'new_bucket'], | ||
raise_on_failure=False) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |