Skip to content

Commit

Permalink
Tag the existing integration tests with service names
Browse files Browse the repository at this point in the history
I've added the following service name tags that should be
compatible with the previous '-t' arg:

* s3
* ssl
* s3mfa
* gs
* sqs
* ec2
* autoscale
* sdb
* dynamodb
* sts
* swf
  • Loading branch information
James Saryerwinnie committed Jun 15, 2012
1 parent 87f69f9 commit 036bc2b
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 27 deletions.
11 changes: 6 additions & 5 deletions tests/integration/autoscale/test_connection.py
Expand Up @@ -35,7 +35,10 @@
from boto.ec2.autoscale.instance import Instance
from boto.ec2.autoscale.tag import Tag


class AutoscaleConnectionTest(unittest.TestCase):
ec2 = True
autoscale = True

def test_basic(self):
# NB: as it says on the tin these are really basic tests that only
Expand Down Expand Up @@ -146,10 +149,10 @@ def test_basic(self):
if group.name == group_name:
if not group.instances:
instances = False

group.delete()
lc.delete()

found = True
while found:
found = False
Expand All @@ -158,9 +161,7 @@ def test_basic(self):
for tag in tags:
if tag.resource_id == group_name and tag.key == 'foo':
found = True

assert not found

print '--- tests completed ---'


1 change: 1 addition & 0 deletions tests/integration/dynamodb/test_layer1.py
Expand Up @@ -35,6 +35,7 @@
json_doc = """{"access_key": "ASIAIV7R2NUUJ6SB7GKQ", "secret_key": "eIfijGxJlejHDSQiaGr6b7U805U0GKWmllCTt2ZM", "request_id": "28c17897-4555-11e1-8bb1-2529f165f2f0", "expiration": "2012-01-23T00:59:45.617Z", "session_token": "AQoDYXdzEPn//////////wEasAGDXeGY8bx36NLRSA1v3dy2x00k3FNA2KVsMEXkQuKY08gPTtYs2tefZTBsTjgjC+O6j8ieoB1on2bPyCq872+Yq3cipls8jna+PNSEcsXtC8CJBKai/FfYNg1XUHam6EUCtRiUHvqztOVgaGqUUS1UbrBKB7kKSXzgKrJ9AT0bvqi4hZS0ayaU8969f2HIbN9psXhRBKpJyB9FUPuVYpYYZsz9NY3y2kGtK+dgfrKvxyDxxfL4BA=="}"""

class DynamoDBLayer1Test (unittest.TestCase):
dynamodb = True

def test_layer1_basic(self):
print '--- running DynamoDB Layer1 tests ---'
Expand Down
1 change: 1 addition & 0 deletions tests/integration/dynamodb/test_layer2.py
Expand Up @@ -34,6 +34,7 @@
from boto.dynamodb.condition import *

class DynamoDBLayer2Test (unittest.TestCase):
dynamodb = True

def test_layer2_basic(self):
print '--- running Amazon DynamoDB Layer2 tests ---'
Expand Down
1 change: 1 addition & 0 deletions tests/integration/ec2/cloudwatch/test_connection.py
Expand Up @@ -100,6 +100,7 @@


class CloudWatchConnectionTest(unittest.TestCase):
ec2 = True

def test_build_list_params(self):
c = CloudWatchConnection()
Expand Down
1 change: 1 addition & 0 deletions tests/integration/ec2/elb/test_connection.py
Expand Up @@ -28,6 +28,7 @@
from boto.ec2.elb import ELBConnection

class ELBConnectionTest(unittest.TestCase):
ec2 = True

def tearDown(self):
""" Deletes all load balancers after every test. """
Expand Down
10 changes: 8 additions & 2 deletions tests/integration/ec2/test_connection.py
Expand Up @@ -27,13 +27,17 @@

import unittest
import time
from boto.ec2.connection import EC2Connection
import telnetlib
import socket

from nose.plugins.attrib import attr
from boto.ec2.connection import EC2Connection

class EC2ConnectionTest (unittest.TestCase):
ec2 = True

def test_1_basic(self):
@attr('notdefault')
def test_launch_permissions(self):
# this is my user_id, if you want to run these tests you should
# replace this with yours or they won't work
user_id = '963068290131'
Expand All @@ -57,7 +61,9 @@ def test_1_basic(self):
d = image.get_launch_permissions()
assert 'groups' not in d

def test_1_basic(self):
# create 2 new security groups
c = EC2Connection()
group1_name = 'test-%d' % int(time.time())
group_desc = 'This is a security group created during unit testing'
group1 = c.create_security_group(group1_name, group_desc)
Expand Down
1 change: 1 addition & 0 deletions tests/integration/s3/test_bucket.py
Expand Up @@ -34,6 +34,7 @@
from boto.s3.acl import Grant

class S3BucketTest (unittest.TestCase):
s3 = True

def setUp(self):
self.conn = S3Connection()
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/s3/test_connection.py
Expand Up @@ -34,7 +34,9 @@
from boto.s3.bucket import Bucket
from boto.exception import S3PermissionsError, S3ResponseError


class S3ConnectionTest (unittest.TestCase):
s3 = True

def test_1_basic(self):
print '--- running S3Connection tests ---'
Expand Down
1 change: 1 addition & 0 deletions tests/integration/s3/test_encryption.py
Expand Up @@ -51,6 +51,7 @@
}"""

class S3EncryptionTest (unittest.TestCase):
s3 = True

def test_1_versions(self):
print '--- running S3Encryption tests ---'
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/s3/test_gsconnection.py
Expand Up @@ -60,7 +60,8 @@ def has_google_credentials():
"Google credentials are required to run the Google "
"Cloud Storage tests. Update your boto.cfg to run "
"these tests.")
class GSConnectionTest (unittest.TestCase):
class GSConnectionTest(unittest.TestCase):
gs = True

def test_1_basic(self):
"""basic regression test for Google Cloud Storage"""
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/s3/test_https_cert_validation.py
Expand Up @@ -63,9 +63,8 @@
INVALID_HOSTNAME_HOST = os.environ.get('INVALID_HOSTNAME_HOST', 'www')


@attr('notdefault')
class CertValidationTest (unittest.TestCase):

@attr('notdefault', 'ssl')
class CertValidationTest(unittest.TestCase):
def setUp(self):
# Clear config
for section in boto.config.sections():
Expand Down
1 change: 1 addition & 0 deletions tests/integration/s3/test_key.py
Expand Up @@ -34,6 +34,7 @@
from boto.exception import S3ResponseError

class S3KeyTest (unittest.TestCase):
s3 = True

def setUp(self):
self.conn = S3Connection()
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/s3/test_multidelete.py
Expand Up @@ -34,7 +34,8 @@
from boto.s3.connection import S3Connection
from boto.exception import S3ResponseError

class S3MultiDeleteTest (unittest.TestCase):
class S3MultiDeleteTest(unittest.TestCase):
s3 = True

def setUp(self):
self.conn = S3Connection()
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/s3/test_multipart.py
Expand Up @@ -37,7 +37,9 @@
import StringIO
from boto.s3.connection import S3Connection

class S3MultiPartUploadTest (unittest.TestCase):

class S3MultiPartUploadTest(unittest.TestCase):
s3 = True

def setUp(self):
self.conn = S3Connection(is_secure=False)
Expand Down
1 change: 1 addition & 0 deletions tests/integration/s3/test_resumable_downloads.py 100755 → 100644
Expand Up @@ -61,6 +61,7 @@ class ResumableDownloadTests(unittest.TestCase):
"""
Resumable download test suite.
"""
gs = True

def get_suite_description(self):
return 'Resumable download test suite'
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/s3/test_resumable_uploads.py 100755 → 100644
Expand Up @@ -61,6 +61,7 @@ class ResumableUploadTests(unittest.TestCase):
"""
Resumable upload test suite.
"""
gs = True

def get_suite_description(self):
return 'Resumable upload test suite'
Expand Down Expand Up @@ -448,7 +449,7 @@ def test_upload_with_file_size_change_between_starts(self):
# This abort should be a hard abort (file size changing during
# transfer).
self.assertEqual(e.disposition, ResumableTransferDisposition.ABORT)
self.assertNotEqual(e.message.find('file size changed'), -1, e.message)
self.assertNotEqual(e.message.find('file size changed'), -1, e.message)

def test_upload_with_file_size_change_during_upload(self):
"""
Expand Down
1 change: 1 addition & 0 deletions tests/integration/sdb/test_connection.py
Expand Up @@ -31,6 +31,7 @@
from boto.exception import SDBResponseError

class SDBConnectionTest (unittest.TestCase):
sdb = True

def test_1_basic(self):
print '--- running SDBConnection tests ---'
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/sts/test_session_token.py
Expand Up @@ -15,7 +15,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
Expand All @@ -32,6 +32,7 @@
from boto.s3.connection import S3Connection

class SessionTokenTest (unittest.TestCase):
sts = True

def test_session_token(self):
print '--- running Session Token tests ---'
Expand All @@ -54,12 +55,11 @@ def test_session_token(self):
os.unlink('token.json')

assert not token.is_expired()

# Try using the session token with S3
s3 = S3Connection(aws_access_key_id=token.access_key,
aws_secret_access_key=token.secret_key,
security_token=token.session_token)
buckets = s3.get_all_buckets()

print '--- tests completed ---'

1 change: 1 addition & 0 deletions tests/integration/swf/test_layer1.py
Expand Up @@ -57,6 +57,7 @@ class SimpleWorkflowLayer1TestBase(unittest.TestCase):
* SimpleWorkflowLayer1Test
* tests.swf.test_layer1_workflow_execution.SwfL1WorkflowExecutionTest
"""
swf = True
# Some params used throughout the tests...
# Domain registration params...
_domain = BOTO_SWF_UNITTEST_DOMAIN
Expand Down
22 changes: 12 additions & 10 deletions tests/integration/swf/test_layer1_workflow_execution.py
Expand Up @@ -17,14 +17,16 @@ class SwfL1WorkflowExecutionTest(SimpleWorkflowLayer1TestBase):
"""
test a simple workflow execution
"""
swf = True

def run_decider(self):
"""
run one iteration of a simple decision engine
"""
# Poll for a decision task.
tries = 0
tries = 0
while True:
dtask = self.conn.poll_for_decision_task(self._domain,
dtask = self.conn.poll_for_decision_task(self._domain,
self._task_list, reverse_order=True)
if dtask.get('taskToken') is not None:
# This means a real decision task has arrived.
Expand Down Expand Up @@ -52,8 +54,8 @@ def run_decider(self):
decisions = Layer1Decisions()
if event['eventType'] == 'WorkflowExecutionStarted':
activity_id = str(uuid.uuid1())
decisions.schedule_activity_task(activity_id,
self._activity_type_name, self._activity_type_version,
decisions.schedule_activity_task(activity_id,
self._activity_type_name, self._activity_type_version,
task_list=self._task_list,
input=event['workflowExecutionStartedEventAttributes']['input'])
elif event['eventType'] == 'ActivityTaskCompleted':
Expand All @@ -79,9 +81,9 @@ def run_worker(self):
run one iteration of a simple worker engine
"""
# Poll for an activity task.
tries = 0
tries = 0
while True:
atask = self.conn.poll_for_activity_task(self._domain,
atask = self.conn.poll_for_activity_task(self._domain,
self._task_list, identity='test worker')
if atask.get('activityId') is not None:
# This means a real activity task has arrived.
Expand All @@ -102,12 +104,12 @@ def run_worker(self):
if reason is None:
r = self.conn.respond_activity_task_completed(
atask['taskToken'], result)
else:
else:
r = self.conn.respond_activity_task_failed(
atask['taskToken'], reason=reason, details=details)
assert r is None


def test_workflow_execution(self):
# Start a workflow execution whose activity task will succeed.
workflow_id = 'wfid-%.2f' % (time.time(),)
Expand All @@ -132,7 +134,7 @@ def test_workflow_execution(self):
self.run_decider()

# Check that the result was stored in the execution history.
r = self.conn.get_workflow_execution_history(self._domain,
r = self.conn.get_workflow_execution_history(self._domain,
run_id, workflow_id,
reverse_order=True)['events'][0]
result = r['workflowExecutionCompletedEventAttributes']['result']
Expand Down Expand Up @@ -163,7 +165,7 @@ def test_failed_workflow_execution(self):
self.run_decider()

# Check that the failure was stored in the execution history.
r = self.conn.get_workflow_execution_history(self._domain,
r = self.conn.get_workflow_execution_history(self._domain,
run_id, workflow_id,
reverse_order=True)['events'][0]
reason = r['workflowExecutionFailedEventAttributes']['reason']
Expand Down

0 comments on commit 036bc2b

Please sign in to comment.