atlas-init 0.3.5__py3-none-any.whl → 0.3.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- atlas_init/__init__.py +1 -1
- atlas_init/cli_tf/debug_logs.py +28 -4
- atlas_init/cli_tf/debug_logs_test_data.py +0 -2
- atlas_init/cli_tf/debug_logs_test_data_package_config.py +7 -0
- atlas_init/cli_tf/mock_tf_log.py +16 -3
- {atlas_init-0.3.5.dist-info → atlas_init-0.3.7.dist-info}/METADATA +1 -1
- {atlas_init-0.3.5.dist-info → atlas_init-0.3.7.dist-info}/RECORD +9 -9
- {atlas_init-0.3.5.dist-info → atlas_init-0.3.7.dist-info}/WHEEL +0 -0
- {atlas_init-0.3.5.dist-info → atlas_init-0.3.7.dist-info}/entry_points.txt +0 -0
atlas_init/__init__.py
CHANGED
atlas_init/cli_tf/debug_logs.py
CHANGED
@@ -32,7 +32,16 @@ class PathHeadersPayload(Entity):
|
|
32
32
|
|
33
33
|
@property
|
34
34
|
def expect_list_response(self) -> bool:
|
35
|
-
|
35
|
+
final_path = self.path.split("/")[-1]
|
36
|
+
if final_path in {"settings", "processArgs"}:
|
37
|
+
return False
|
38
|
+
return self.method == "GET" and self.path.endswith("s") and all(not c.isdigit() for c in final_path)
|
39
|
+
|
40
|
+
@model_validator(mode="after")
|
41
|
+
def normalize_path(self) -> Self:
|
42
|
+
if "?" in self.path:
|
43
|
+
self.path = self.path.split("?", 1)[0]
|
44
|
+
return self
|
36
45
|
|
37
46
|
|
38
47
|
def parse_request(request_lines: list[str]) -> PathHeadersPayload:
|
@@ -107,13 +116,28 @@ class SDKRoundtrip(Entity):
|
|
107
116
|
return extract_version(content_type_req)
|
108
117
|
raise ValueError(f"Could not extract version from req/resp: {content_type} or {content_type_req}")
|
109
118
|
|
119
|
+
@property
|
120
|
+
def java_method_match(self) -> bool:
|
121
|
+
java_method = self.response.headers.get("X-Java-Method")
|
122
|
+
if not java_method:
|
123
|
+
return False
|
124
|
+
java_method_final = java_method.split("::")[-1]
|
125
|
+
final_req_path = self.request.path.split("/")[-1]
|
126
|
+
return final_req_path.lower() in java_method_final.lower()
|
127
|
+
|
110
128
|
@model_validator(mode="after")
|
111
129
|
def ensure_match(self) -> Self:
|
130
|
+
if self.java_method_match:
|
131
|
+
return self
|
112
132
|
req = self.request
|
113
133
|
resp = self.response
|
114
|
-
|
115
|
-
|
134
|
+
resp_payload_dict, resp_payload_list, __ = parsed(resp.text)
|
135
|
+
resp_payload_dict = resp_payload_dict or {}
|
136
|
+
want_list = req.expect_list_response
|
137
|
+
if want_list and resp_payload_list is None and "results" not in resp_payload_dict:
|
116
138
|
raise ValueError(f"Expected list response but got dict: {resp.text}")
|
139
|
+
if not want_list and (resp_payload_list or "results" in resp_payload_dict):
|
140
|
+
raise ValueError(f"Expected dict response but got list: {resp.text}")
|
117
141
|
return self
|
118
142
|
|
119
143
|
def __lt__(self, other) -> bool:
|
@@ -201,7 +225,7 @@ def match_request(
|
|
201
225
|
step_number=step_number,
|
202
226
|
)
|
203
227
|
remaining_responses = [resp for i, resp in enumerate(responses_list) if i not in used_responses]
|
204
|
-
err_msg = f"Could not match request {ref} with any response\n\n{request}\n\n\nThere are #{len(remaining_responses)} responses left that doesn't match\n{'-'*80}\n{'\n'.join(r.text for r in remaining_responses)}"
|
228
|
+
err_msg = f"Could not match request {request.path} ({ref}) with any response\n\n{request}\n\n\nThere are #{len(remaining_responses)} responses left that doesn't match\n{'-'*80}\n{'\n'.join(r.text for r in remaining_responses)}"
|
205
229
|
raise ValueError(err_msg)
|
206
230
|
|
207
231
|
|
@@ -46,3 +46,10 @@ def package_skip_suffixes(pkg_name: str) -> list[str]:
|
|
46
46
|
if pkg_name == "resourcepolicy":
|
47
47
|
return [":validate"]
|
48
48
|
return []
|
49
|
+
|
50
|
+
|
51
|
+
def package_must_substrings(pkg_name: str) -> list[str]:
|
52
|
+
# sourcery skip: assign-if-exp, reintroduce-else
|
53
|
+
if pkg_name == "advancedcluster":
|
54
|
+
return ["/clusters"]
|
55
|
+
return []
|
atlas_init/cli_tf/mock_tf_log.py
CHANGED
@@ -23,7 +23,11 @@ from atlas_init.cli_tf.debug_logs_test_data import (
|
|
23
23
|
create_mock_data,
|
24
24
|
default_is_diff,
|
25
25
|
)
|
26
|
-
from atlas_init.cli_tf.debug_logs_test_data_package_config import
|
26
|
+
from atlas_init.cli_tf.debug_logs_test_data_package_config import (
|
27
|
+
package_modifiers,
|
28
|
+
package_must_substrings,
|
29
|
+
package_skip_suffixes,
|
30
|
+
)
|
27
31
|
from atlas_init.repos.go_sdk import (
|
28
32
|
api_spec_path_transformed,
|
29
33
|
download_admin_api,
|
@@ -39,6 +43,7 @@ class MockTFLog(Entity):
|
|
39
43
|
output_dir: Path
|
40
44
|
admin_api_path: Path
|
41
45
|
diff_skip_suffixes: list[str] = Field(default_factory=list)
|
46
|
+
diff_must_substrings: list[str] = Field(default_factory=list)
|
42
47
|
keep_duplicates: bool = False
|
43
48
|
modifiers: list[RTModifier] = Field(default_factory=list)
|
44
49
|
package_name: str = ""
|
@@ -57,10 +62,16 @@ class MockTFLog(Entity):
|
|
57
62
|
if (package_name := self.package_name) and not self.skip_default_package_config:
|
58
63
|
self.modifiers.extend(package_modifiers(package_name))
|
59
64
|
self.diff_skip_suffixes.extend(package_skip_suffixes(package_name))
|
65
|
+
self.diff_must_substrings.extend(package_must_substrings(package_name))
|
60
66
|
return self
|
61
67
|
|
62
68
|
def differ(self, rt: SDKRoundtrip) -> bool:
|
63
|
-
|
69
|
+
is_diff = default_is_diff(rt) and not any(
|
70
|
+
rt.request.path.endswith(suffix) for suffix in self.diff_skip_suffixes
|
71
|
+
)
|
72
|
+
if is_diff and self.diff_must_substrings:
|
73
|
+
return is_diff and all(substring in rt.request.path for substring in self.diff_must_substrings)
|
74
|
+
return is_diff
|
64
75
|
|
65
76
|
|
66
77
|
def mock_tf_log(req: MockTFLog) -> Path:
|
@@ -117,6 +128,7 @@ def mock_tf_log_cmd(
|
|
117
128
|
log_diff_roundtrips: bool = typer.Option(
|
118
129
|
False, "-l", "--log-diff-roundtrips", help="print out the roundtrips used in diffs"
|
119
130
|
),
|
131
|
+
package_name: str = typer.Option("", "-p", "--package-name", help="the package name to use for modifiers"),
|
120
132
|
):
|
121
133
|
cwd = Path.cwd()
|
122
134
|
default_testdir = cwd / "testdata"
|
@@ -128,6 +140,7 @@ def mock_tf_log_cmd(
|
|
128
140
|
diff_skip_suffixes=diff_skip_suffixes,
|
129
141
|
keep_duplicates=keep_duplicates,
|
130
142
|
log_diff_roundtrips=log_diff_roundtrips,
|
143
|
+
package_name=package_name,
|
131
144
|
)
|
132
145
|
mock_tf_log(event_in)
|
133
146
|
|
@@ -171,6 +184,6 @@ def log_diff_roundtrips(roundtrips: list[SDKRoundtrip], differ: Callable[[SDKRou
|
|
171
184
|
step_nr = rt.step_number
|
172
185
|
diff_count += 1
|
173
186
|
logger.info(
|
174
|
-
f"\n{rt.request.method} {rt.request.path}\n{rt.request.text}\n{rt.response.status}-{rt.response.status_text}\n{rt.response.text}"
|
187
|
+
f"\n{rt.request.method} {rt.request.path} {rt.version}\n{rt.request.text}\n{rt.response.status}-{rt.response.status_text}\n{rt.response.text}"
|
175
188
|
)
|
176
189
|
logger.info(f"Diffable requests: {diff_count}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: atlas-init
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.7
|
4
4
|
Project-URL: Documentation, https://github.com/EspenAlbert/atlas-init#readme
|
5
5
|
Project-URL: Issues, https://github.com/EspenAlbert/atlas-init/issues
|
6
6
|
Project-URL: Source, https://github.com/EspenAlbert/atlas-init
|
@@ -1,4 +1,4 @@
|
|
1
|
-
atlas_init/__init__.py,sha256=
|
1
|
+
atlas_init/__init__.py,sha256=6fPQOXGNVhrm-NHeu2MniZbhzKrbg2XjuDcXCG4gGqY,372
|
2
2
|
atlas_init/__main__.py,sha256=dY1dWWvwxRZMmnOFla6RSfti-hMeLeKdoXP7SVYqMUc,52
|
3
3
|
atlas_init/atlas_init.yaml,sha256=OAosOZw4kjhTWcPeEv0jtztRFWRhsie8D9r5afySAxM,2065
|
4
4
|
atlas_init/cli.py,sha256=xOnAOUccHDLkivICdF0GsLhccr_IxvnTKTbe1KGW7kU,8971
|
@@ -24,14 +24,14 @@ atlas_init/cli_root/trigger.py,sha256=oEgqb_l25tyYgUaFHEuChcOCJA7k3mnRa4D-Myz-Ig
|
|
24
24
|
atlas_init/cli_tf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
atlas_init/cli_tf/app.py,sha256=0Y5c-Pc9ibOz6kXvFlL-yhH_fx1nHLgBgK9OAVqjX9s,11390
|
26
26
|
atlas_init/cli_tf/changelog.py,sha256=biWYKf1pZvXZ-jEgcZ5q9sY7nTGrL2PuI0h9mCILf_g,3181
|
27
|
-
atlas_init/cli_tf/debug_logs.py,sha256=
|
28
|
-
atlas_init/cli_tf/debug_logs_test_data.py,sha256
|
29
|
-
atlas_init/cli_tf/debug_logs_test_data_package_config.py,sha256=
|
27
|
+
atlas_init/cli_tf/debug_logs.py,sha256=NvIEtOb30aK_drYgNyYDsXt7uNtw6L9vhIZicANyDRQ,10022
|
28
|
+
atlas_init/cli_tf/debug_logs_test_data.py,sha256=-KfhlVgp00zXzV0XMVbABEwKpBZ_r2B-cjBKLuhiBZU,9471
|
29
|
+
atlas_init/cli_tf/debug_logs_test_data_package_config.py,sha256=BOAgln1pWne_ZhP6a0SM2ddn2csr0sgGkYf2kMS_V9o,1666
|
30
30
|
atlas_init/cli_tf/github_logs.py,sha256=VD7qhlXNuG21eTuJ5VI7rsflp5WHSodfngkRVgQlumw,8114
|
31
31
|
atlas_init/cli_tf/go_test_run.py,sha256=LQUQ-3zJ8EUCixwu33QTAzUns3um793osst8tE0UKjk,6792
|
32
32
|
atlas_init/cli_tf/go_test_run_format.py,sha256=OUd6QPHDeTzbwVuh6MhP-xXgjOOGP9W_sCLJ8KylBTs,1201
|
33
33
|
atlas_init/cli_tf/go_test_summary.py,sha256=agr4SITgxchjgOzRpScoTUk-iG38QDLkpnsMtTW9GTY,5382
|
34
|
-
atlas_init/cli_tf/mock_tf_log.py,sha256=
|
34
|
+
atlas_init/cli_tf/mock_tf_log.py,sha256=1Q5OWkDM1Dxac5vhG-vMVGScDBnXmwruZjsHDya5Uu4,7546
|
35
35
|
atlas_init/cli_tf/schema.py,sha256=iwvb4wD2Wba0MMu7ooTNAIi1jHbpLiXGPOT51_o_YW8,12431
|
36
36
|
atlas_init/cli_tf/schema_go_parser.py,sha256=PiRfFFVnkhltxcGFfOCgH53wwzIEynw2BXmSfaINLL8,8294
|
37
37
|
atlas_init/cli_tf/schema_inspection.py,sha256=ujLvGfg3baByND4nRD0drZoI45STxo3VfYvim-PfVOc,1764
|
@@ -88,7 +88,7 @@ atlas_init/tf/modules/vpc_peering/vpc_peering.tf,sha256=hJ3KJdGbLpOQednUpVuiJ0Cq
|
|
88
88
|
atlas_init/tf/modules/vpc_privatelink/atlas-privatelink.tf,sha256=FloaaX1MNDvoMZxBnEopeLKyfIlq6kaX2dmx8WWlXNU,1298
|
89
89
|
atlas_init/tf/modules/vpc_privatelink/variables.tf,sha256=gktHCDYD4rz6CEpLg5aiXcFbugw4L5S2Fqc52QYdJyc,255
|
90
90
|
atlas_init/tf/modules/vpc_privatelink/versions.tf,sha256=G0u5V_Hvvrkux_tqfOY05pA-GzSp_qILpfx1dZaTGDc,237
|
91
|
-
atlas_init-0.3.
|
92
|
-
atlas_init-0.3.
|
93
|
-
atlas_init-0.3.
|
94
|
-
atlas_init-0.3.
|
91
|
+
atlas_init-0.3.7.dist-info/METADATA,sha256=JsyU3TvkLcpLmTq0QDcuavjTz-J6l31nZf6qsTvljxs,5650
|
92
|
+
atlas_init-0.3.7.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
93
|
+
atlas_init-0.3.7.dist-info/entry_points.txt,sha256=oSNFIEAS9nUZyyZ8Fc-0F0U5j-NErygy01LpJVSHapQ,57
|
94
|
+
atlas_init-0.3.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|