Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
akinaka
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
olindata
akinaka
Commits
d093b785
Verified
Commit
d093b785
authored
Apr 21, 2019
by
Afraz Ahmadzadeh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: Testing the tests ;)
parent
e2ebbfbf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
.gitignore
.gitignore
+1
-0
akinaka_update/tests/test_update_asg.py
akinaka_update/tests/test_update_asg.py
+65
-0
No files found.
.gitignore
View file @
d093b785
...
...
@@ -11,3 +11,4 @@
/build/*
.vscode
new_asg.txt
src/*
akinaka_update/tests/test_update_asg.py
0 → 100755
View file @
d093b785
#!/usr/bin/env python3
import
unittest
from
moto
import
mock_ec2
from
moto
import
mock_elbv2
from
moto
import
mock_iam
from
moto
import
mock_sts
from
moto
import
mock_s3
from
moto
import
mock_autoscaling
import
boto3
from
akinaka_update.asg
import
update_asg
from
akinaka_update.targetgroup
import
update_targetgroup
class
TestUpdateASG
(
unittest
.
TestCase
):
@
classmethod
@
mock_ec2
@
mock_elbv2
@
mock_iam
@
mock_sts
@
mock_autoscaling
def
setUp
(
self
):
asg_client
=
boto3
.
client
(
'autoscaling'
,
region_name
=
'eu-west-1'
)
elb_client
=
boto3
.
client
(
'elbv2'
,
region_name
=
'eu-west-1'
)
elb_client
.
create_target_group
(
Name
=
"multi_targetgroup"
,
)
asg_client
.
create_auto_scaling_group
(
AutoScalingGroupName
=
'multi_targetgroup_blue'
,
MinSize
=
1
,
MaxSize
=
1
,
AvailabilityZones
=
[
'eu-west-1'
]
)
@
mock_ec2
@
mock_elbv2
@
mock_iam
@
mock_sts
@
mock_autoscaling
def
test_scale
(
self
):
"""
Given a target group, returns it's ARN
Given a load balancer with a single target group, returns that target group's ARN
"""
self
.
asg
=
update_asg
.
ASG
(
ami
=
"ami-04df31188f11f32d7"
,
region
=
"eu-central-1"
,
role_arn
=
"arn:aws:iam::883986860371:role/production_assumable"
,
loadbalancer
=
None
,
asg
=
None
,
target_group
=
"webapi"
,
scale_to
=
"scale_to"
)
result
=
self
.
asg
.
scale
(
"foobar"
,
1
,
1
,
1
)
self
.
assertEqual
(
result
,
6
)
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment