Skip to content

Commit

Permalink
Merge pull request #232 from remind101/remove_test_depend_on_stacker_…
Browse files Browse the repository at this point in the history
…blueprints

Remove dependency on stacker_blueprints
  • Loading branch information
phobologic authored Sep 23, 2016
2 parents 620e629 + cf9cdbb commit 7a72aec
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 34 deletions.
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
tests_require = [
"nose~=1.0",
"mock~=2.0.0",
"stacker_blueprints~=0.6.0",
"moto~=0.4.25",
"testfixtures~=4.10.0",
]
Expand Down
4 changes: 2 additions & 2 deletions stacker/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
def generate_definition(base_name, stack_id, **overrides):
definition = {
"name": "%s.%d" % (base_name, stack_id),
"class_path": "stacker_blueprints.%s.%s" % (base_name,
base_name.upper()),
"class_path": "stacker.tests.fixtures.mock_blueprints.%s" % (
base_name.upper()),
"namespace": "example-com",
"parameters": {
"InstanceType": "m3.medium",
Expand Down
Empty file.
93 changes: 93 additions & 0 deletions stacker/tests/fixtures/mock_blueprints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
from stacker.blueprints.base import Blueprint


class VPC(Blueprint):
LOCAL_PARAMETERS = {
"AZCount": {
"type": int,
"default": 2,
}
}

PARAMETERS = {
"PrivateSubnets": {
"type": "CommaDelimitedList",
"description": "Comma separated list of subnets to use for "
"non-public hosts. NOTE: Must have as many subnets "
"as AZCount"},
"PublicSubnets": {
"type": "CommaDelimitedList",
"description": "Comma separated list of subnets to use for "
"public hosts. NOTE: Must have as many subnets "
"as AZCount"},
"InstanceType": {
"type": "String",
"description": "NAT EC2 instance type.",
"default": "m3.medium"},
"SshKeyName": {
"type": "AWS::EC2::KeyPair::KeyName"},
"BaseDomain": {
"type": "String",
"default": "",
"description": "Base domain for the stack."},
"InternalDomain": {
"type": "String",
"default": "",
"description": "Internal domain name, if you have one."},
"CidrBlock": {
"type": "String",
"description": "Base CIDR block for subnets.",
"default": "10.128.0.0/16"},
"ImageName": {
"type": "String",
"description": "The image name to use from the AMIMap (usually "
"found in the config file.)",
"default": "NAT"},
"UseNatGateway": {
"type": "String",
"allowed_values": ["true", "false"],
"description": "If set to true, will configure a NAT Gateway"
"instead of NAT instances.",
"default": "false"},
}

def create_template(self):
return


class Bastion(Blueprint):
PARAMETERS = {
"VpcId": {"type": "AWS::EC2::VPC::Id", "description": "Vpc Id"},
"DefaultSG": {"type": "AWS::EC2::SecurityGroup::Id",
"description": "Top level security group."},
"PublicSubnets": {"type": "List<AWS::EC2::Subnet::Id>",
"description": "Subnets to deploy public "
"instances in."},
"PrivateSubnets": {"type": "List<AWS::EC2::Subnet::Id>",
"description": "Subnets to deploy private "
"instances in."},
"AvailabilityZones": {"type": "CommaDelimitedList",
"description": "Availability Zones to deploy "
"instances in."},
"InstanceType": {"type": "String",
"description": "EC2 Instance Type",
"default": "m3.medium"},
"MinSize": {"type": "Number",
"description": "Minimum # of instances.",
"default": "1"},
"MaxSize": {"type": "Number",
"description": "Maximum # of instances.",
"default": "5"},
"SshKeyName": {"type": "AWS::EC2::KeyPair::KeyName"},
"OfficeNetwork": {
"type": "String",
"description": "CIDR block allowed to connect to bastion hosts."},
"ImageName": {
"type": "String",
"description": "The image name to use from the AMIMap (usually "
"found in the config file.)",
"default": "bastion"},
}

def create_template(self):
return
33 changes: 2 additions & 31 deletions stacker/tests/fixtures/vpc-bastion-db-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ vpc_parameters: &vpc_parameters

stacks:
- name: vpc
class_path: stacker_blueprints.vpc.VPC
class_path: stacker.tests.fixtures.mock_blueprints.VPC
parameters:
InstanceType: m3.medium
SshKeyName: default
Expand All @@ -48,7 +48,7 @@ stacks:
# Options
#InternalDomain: internal
- name: bastion
class_path: stacker_blueprints.bastion.Bastion
class_path: stacker.tests.fixtures.mock_blueprints.Bastion
parameters:
# Extends the parameters dict with the contents of the vpc_parameters
# anchor. Basically we're including all VPC Outputs in the parameters
Expand All @@ -63,32 +63,3 @@ stacks:
MaxSize: 2
SshKeyName: default
ImageName: bastion
- name: myDB
class_path: stacker_blueprints.postgres.PostgresRDS
parameters:
<< : *vpc_parameters
InstanceType: db.m3.medium
AllocatedStorage: 10
MasterUser: dbuser
MasterUserPassword: ExamplePassword!
DBName: db1
# If the following are uncommented and you set an InternalDomain above
# in the VPC a CNAME alias of InternalHostname will be setup pointing at
# the database.
#InternalZoneId: vpc::InternalZoneId
#InternalZoneName: vpc::InternalZoneName
#InternalHostname: mydb
- name: myWeb
class_path: stacker_blueprints.asg.AutoscalingGroup
parameters:
<< : *vpc_parameters
InstanceType: m3.medium
ImageName: ubuntu1404
MinSize: 2
MaxSize: 2
SshKeyName: default
# If commented out, no load balancer will be created.
ELBHostName: mysite
# Uncomment if you have a cert loaded in EC2 already and want to enable
# SSL on the load balancer.
#ELBCertName: mycert
1 change: 1 addition & 0 deletions stacker/tests/test_plan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest

import mock

from stacker.context import Context
Expand Down

0 comments on commit 7a72aec

Please sign in to comment.