Merge lp:~sinzui/juju-ci-tools/url-limit into lp:juju-ci-tools

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 1977
Proposed branch: lp:~sinzui/juju-ci-tools/url-limit
Merge into: lp:juju-ci-tools
Diff against target: 159 lines (+27/-15)
2 files modified
assess_add_cloud.py (+11/-3)
tests/test_assess_add_cloud.py (+16/-12)
To merge this branch: bzr merge lp:~sinzui/juju-ci-tools/url-limit
Reviewer Review Type Date Requested Status
Juju Release Engineering Pending
Review via email: mp+321918@code.launchpad.net

Description of the change

Defined EXCEEDED_LIMIT because the add-cloud limits are understood to be arbitrary and bogus.

URLs are limited to 2083 bytes in many browsers, anything more is excessive.
Juju has set 4096 as being excessive, but it needs to be lowered
https://bugs.launchpad.net/juju/+bug/1678833

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'assess_add_cloud.py'
2--- assess_add_cloud.py 2017-04-04 18:23:28 +0000
3+++ assess_add_cloud.py 2017-04-04 19:52:37 +0000
4@@ -25,6 +25,12 @@
5 )
6
7
8+# URLs are limited to 2083 bytes in many browsers, anything more is excessive.
9+# Juju has set 4096 as being excessive, but it needs to be lowered
10+# https://bugs.launchpad.net/juju/+bug/1678833
11+EXCEEDED_LIMIT = 4096
12+
13+
14 class CloudMismatch(JujuAssertionError):
15 """The clouds did not match in some way."""
16
17@@ -109,8 +115,10 @@
18 spec = xfail(spec, 1649721, InvalidEndpoint)
19 yield spec
20
21+ long_text = 'A' * EXCEEDED_LIMIT
22+
23 for cloud_name, cloud in clouds.items():
24- spec = xfail(cloud_spec('long-name-{}'.format(cloud_name), 'A' * 4096,
25+ spec = xfail(cloud_spec('long-name-{}'.format(cloud_name), long_text,
26 cloud, NameNotAccepted), 1641970, NameMismatch)
27 if cloud['type'] == 'manual' and endpoint_validation:
28 spec = xfail(spec, 1649721, InvalidEndpoint)
29@@ -131,7 +139,7 @@
30
31 if 'endpoint' in cloud:
32 variant = deepcopy(cloud)
33- variant['endpoint'] = 'A' * 4096
34+ variant['endpoint'] = long_text
35 if variant['type'] == 'vsphere':
36 for region in variant['regions'].values():
37 region['endpoint'] = variant['endpoint']
38@@ -147,7 +155,7 @@
39 continue
40 variant = deepcopy(cloud)
41 region = variant['regions'][region_name]
42- region['endpoint'] = 'A' * 4096
43+ region['endpoint'] = long_text
44 variant_name = 'long-endpoint-{}-{}'.format(cloud_name,
45 region_name)
46 spec = cloud_spec(variant_name, cloud_name, variant,
47
48=== modified file 'tests/test_assess_add_cloud.py'
49--- tests/test_assess_add_cloud.py 2017-04-04 19:35:19 +0000
50+++ tests/test_assess_add_cloud.py 2017-04-04 19:52:37 +0000
51@@ -22,6 +22,7 @@
52 CloudMismatch,
53 CloudSpec,
54 cloud_spec,
55+ EXCEEDED_LIMIT,
56 iter_clouds,
57 NameMismatch,
58 write_status,
59@@ -99,12 +100,15 @@
60 """), stderr.getvalue())
61
62
63+long_text = 'A' * EXCEEDED_LIMIT
64+
65+
66 def make_long_endpoint(spec, endpoint_validation, regions=False):
67 config = deepcopy(spec.config)
68- config['endpoint'] = 'A' * 4096
69+ config['endpoint'] = long_text
70 if regions:
71 for region in config['regions'].values():
72- region['endpoint'] = 'A' * 4096
73+ region['endpoint'] = long_text
74 spec = cloud_spec('long-endpoint-{}'.format(spec.name), spec.name, config,
75 InvalidEndpoint)
76 if not endpoint_validation:
77@@ -123,7 +127,7 @@
78 spec = cloud_spec('foo', 'foo', cloud)
79 self.assertItemsEqual([
80 self.bogus_type, xfail(spec, 1649721, InvalidEndpoint),
81- xfail(xfail(cloud_spec('long-name-foo', 'A' * 4096, cloud),
82+ xfail(xfail(cloud_spec('long-name-foo', long_text, cloud),
83 1641970, NameMismatch), 1649721, InvalidEndpoint),
84 xfail(xfail(cloud_spec('invalid-name-foo', 'invalid/name', cloud,
85 exception=NameNotAccepted), 1641981, None),
86@@ -139,7 +143,7 @@
87 spec = cloud_spec('foo', 'foo', cloud)
88 self.assertItemsEqual([
89 self.bogus_type, spec,
90- xfail(cloud_spec('long-name-foo', 'A' * 4096, cloud),
91+ xfail(cloud_spec('long-name-foo', long_text, cloud),
92 1641970, NameMismatch),
93 xfail(cloud_spec('invalid-name-foo', 'invalid/name', cloud,
94 exception=NameNotAccepted), 1641981, None),
95@@ -159,7 +163,7 @@
96 self.bogus_type, spec,
97 xfail(cloud_spec('invalid-name-foo', 'invalid/name', cloud,
98 exception=NameNotAccepted), 1641981, None),
99- xfail(cloud_spec('long-name-foo', 'A' * 4096, cloud,
100+ xfail(cloud_spec('long-name-foo', long_text, cloud,
101 exception=None), 1641970, NameMismatch),
102 make_long_endpoint(
103 spec, regions=True, endpoint_validation=True),
104@@ -176,7 +180,7 @@
105 self.bogus_type, spec,
106 xfail(cloud_spec('invalid-name-foo', 'invalid/name', cloud,
107 exception=NameNotAccepted), 1641981, None),
108- xfail(cloud_spec('long-name-foo', 'A' * 4096, cloud,
109+ xfail(cloud_spec('long-name-foo', long_text, cloud,
110 exception=None), 1641970, NameMismatch),
111 xfail(make_long_endpoint(spec, regions=True,
112 endpoint_validation=True),
113@@ -193,7 +197,7 @@
114 self.bogus_type, spec,
115 xfail(cloud_spec('invalid-name-foo', 'invalid/name', cloud,
116 exception=NameNotAccepted), 1641981, None),
117- xfail(cloud_spec('long-name-foo', 'A' * 4096, cloud,
118+ xfail(cloud_spec('long-name-foo', long_text, cloud,
119 exception=None), 1641970, NameMismatch),
120 make_long_endpoint(spec, endpoint_validation=True),
121 ], iter_clouds({'foo': cloud}, endpoint_validation=True))
122@@ -208,7 +212,7 @@
123 self.bogus_type, spec,
124 xfail(cloud_spec('invalid-name-foo', 'invalid/name', cloud,
125 exception=NameNotAccepted), 1641981, None),
126- xfail(cloud_spec('long-name-foo', 'A' * 4096, cloud,
127+ xfail(cloud_spec('long-name-foo', long_text, cloud,
128 exception=None), 1641970, NameMismatch),
129 make_long_endpoint(spec, endpoint_validation=False),
130 ], iter_clouds({'foo': cloud}, endpoint_validation=False))
131@@ -221,11 +225,11 @@
132 cloud_spec('invalid-name-foo', 'invalid/name', config,
133 exception=NameNotAccepted), 1641981, None)
134 long_name = xfail(
135- cloud_spec('long-name-foo', 'A' * 4096, config, exception=None),
136+ cloud_spec('long-name-foo', long_text, config, exception=None),
137 1641970, NameMismatch)
138 long_region = cloud_spec(
139 'long-endpoint-foo-bar', 'foo', deepcopy(config), InvalidEndpoint)
140- long_region.config['regions']['bar']['endpoint'] = 'A' * 4096
141+ long_region.config['regions']['bar']['endpoint'] = long_text
142 bogus_auth = cloud_spec('bogus-auth-foo', 'foo',
143 deepcopy(config), exception=AuthNotAccepted)
144 bogus_auth.config['auth-types'] = ['asdf']
145@@ -243,12 +247,12 @@
146 cloud_spec('invalid-name-foo', 'invalid/name', config,
147 exception=NameNotAccepted), 1641981, None)
148 long_name = xfail(
149- cloud_spec('long-name-foo', 'A' * 4096, config, exception=None),
150+ cloud_spec('long-name-foo', long_text, config, exception=None),
151 1641970, NameMismatch)
152 long_region = xfail(cloud_spec(
153 'long-endpoint-foo-bar', 'foo', deepcopy(config),
154 InvalidEndpoint), 1641970, CloudMismatch)
155- long_region.config['regions']['bar']['endpoint'] = 'A' * 4096
156+ long_region.config['regions']['bar']['endpoint'] = long_text
157 bogus_auth = cloud_spec('bogus-auth-foo', 'foo',
158 deepcopy(config), exception=AuthNotAccepted)
159 bogus_auth.config['auth-types'] = ['asdf']

Subscribers

People subscribed via source and target branches