Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/functional/elb/test_configure_health_check.py
1567 views
1
#!/usr/bin/env python
2
# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License"). You
5
# may not use this file except in compliance with the License. A copy of
6
# the License is located at
7
#
8
# http://aws.amazon.com/apache2.0/
9
#
10
# or in the "license" file accompanying this file. This file is
11
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
# ANY KIND, either express or implied. See the License for the specific
13
# language governing permissions and limitations under the License.
14
from awscli.testutils import BaseAWSCommandParamsTest
15
16
17
class TestConfigureHealthCheck(BaseAWSCommandParamsTest):
18
19
prefix = 'elb configure-health-check'
20
21
def test_shorthand_basic(self):
22
cmdline = self.prefix
23
cmdline += ' --load-balancer-name my-lb'
24
cmdline += (' --health-check Target=HTTP:80/weather/us/wa/seattle,'
25
'Interval=300,Timeout=60,UnhealthyThreshold=5,'
26
'HealthyThreshold=9')
27
result = {
28
'HealthCheck': {
29
'HealthyThreshold': 9,
30
'Interval': 300,
31
'Target': 'HTTP:80/weather/us/wa/seattle',
32
'Timeout': 60,
33
'UnhealthyThreshold': 5},
34
'LoadBalancerName': 'my-lb'}
35
self.assert_params_for_cmd(cmdline, result)
36
37
def test_json(self):
38
cmdline = self.prefix
39
cmdline += ' --load-balancer-name my-lb '
40
cmdline += ('--health-check {"Target":"HTTP:80/weather/us/wa/seattle'
41
'?a=b","Interval":300,"Timeout":60,'
42
'"UnhealthyThreshold":5,"HealthyThreshold":9}')
43
result = {
44
'HealthCheck': {
45
'HealthyThreshold': 9,
46
'Interval': 300,
47
'Target': 'HTTP:80/weather/us/wa/seattle?a=b',
48
'Timeout': 60,
49
'UnhealthyThreshold': 5},
50
'LoadBalancerName': 'my-lb'}
51
self.assert_params_for_cmd(cmdline, result)
52
53
def test_shorthand_with_multiple_equals_for_value(self):
54
cmdline = self.prefix
55
cmdline += ' --load-balancer-name my-lb'
56
cmdline += (
57
' --health-check Target="HTTP:80/weather/us/wa/seattle?a=b"'
58
',Interval=300,Timeout=60,UnhealthyThreshold=5,'
59
'HealthyThreshold=9'
60
)
61
result = {
62
'HealthCheck': {
63
'HealthyThreshold': 9,
64
'Interval': 300,
65
'Target': 'HTTP:80/weather/us/wa/seattle?a=b',
66
'Timeout': 60,
67
'UnhealthyThreshold': 5},
68
'LoadBalancerName': 'my-lb'}
69
self.assert_params_for_cmd(cmdline, result)
70
71