Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Added fix and test for missing ELB definition as per issue#56
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszraczylo committed Apr 8, 2015
1 parent 4d0a5d8 commit 337ff5a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .eggs/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins.

This directory caches those eggs to prevent repeated downloads.

However, it is safe to delete this directory.

5 changes: 3 additions & 2 deletions bootstrap_cfn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ def process(self):
data.update(s3)
for i in elb:
data.update(i)
for k,v in elb_sgs.items():
data[k] = v
if 'elb_sgs' in locals():
for k, v in elb_sgs.items():
data[k] = v

template = json.loads(pkgutil.get_data('bootstrap_cfn', 'stacks/base.json'))
template['Resources'] = data
Expand Down
6 changes: 3 additions & 3 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_stack_wait_for_stack_not_done(self):
with self.assertRaises(errors.CfnTimeoutError):
print cloudformation.Cloudformation(
self.env.aws_profile).wait_for_stack_done(self.stack_name, 1, 1)

def test_wait_for_stack_done(self):
stack_evt_mock = mock.Mock()
rt = mock.PropertyMock(return_value='AWS::CloudFormation::Stack')
Expand Down Expand Up @@ -484,7 +484,7 @@ def test_is_ssh_up(self):
mock_client = mock.Mock()
mock_config = {'connect.side_effect':AuthenticationException}
mock_client.configure_mock(**mock_config)
mock_p.return_value = mock_client
mock_p.return_value = mock_client
paramiko.SSHClient = mock_p
self.assertTrue(ssh.is_ssh_up('1.1.1.1'))

Expand All @@ -493,7 +493,7 @@ def test_is_ssh_not_up(self):
mock_client = mock.Mock()
mock_config = {'connect.side_effect':socket.error}
mock_client.configure_mock(**mock_config)
mock_p.return_value = mock_client
mock_p.return_value = mock_client
paramiko.SSHClient = mock_p
self.assertFalse(ssh.is_ssh_up('1.1.1.1'))

Expand Down
9 changes: 9 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,15 @@ def test_elb(self):
elb_cfg, elb_sgs = config.elb()
compare(known, elb_cfg)

def test_elb_no_sgs(self):
from testfixtures import compare
project_config = ProjectConfig('tests/sample-project.yaml', 'dev')
# Assuming there's no ELB defined
project_config.config.pop('elb')
project_config.config.pop('rds')
config = ConfigParser(project_config.config, 'my-stack-name')
config.process()

def test_elb_missing_cert(self):
from testfixtures import compare

Expand Down

0 comments on commit 337ff5a

Please sign in to comment.