atlas-init 0.3.4__py3-none-any.whl → 0.3.6__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 CHANGED
@@ -1,6 +1,6 @@
1
1
  from pathlib import Path
2
2
 
3
- VERSION = "0.3.4"
3
+ VERSION = "0.3.6"
4
4
 
5
5
 
6
6
  def running_in_repo() -> bool:
@@ -66,6 +66,7 @@ def run_go_tests(
66
66
  concurrent_runs: int = 20,
67
67
  re_run: bool = False,
68
68
  env_vars: GoEnvVars = GoEnvVars.vscode,
69
+ names: set[str] | None = None,
69
70
  ) -> GoTestResult:
70
71
  test_env = _resolve_env_vars(settings, env_vars)
71
72
  if ci_value := test_env.pop("CI", None):
@@ -84,10 +85,13 @@ def run_go_tests(
84
85
  concurrent_runs = 1
85
86
  test_names = find_individual_tests(repo_path, package_paths)
86
87
  for name, pkg_path in test_names.items():
88
+ if names and name not in names:
89
+ continue
87
90
  results.add_test_package_path(name, pkg_path)
88
91
  commands_to_run[name] = f"go test {packages} -v -run ^{name}$ -timeout {timeout_minutes}m"
89
92
  elif mode == GoTestMode.package:
90
- command = f"go test {packages} -v -run ^TestAcc* -timeout {timeout_minutes}m"
93
+ name_regex = f'^({"|".join(names)})$' if names else "^TestAcc*"
94
+ command = f"go test {packages} -v -run {name_regex} -timeout {timeout_minutes}m"
91
95
  if not group.sequential_tests:
92
96
  command = f"{command} -parallel {concurrent_runs}"
93
97
  commands_to_run[group.name] = command
@@ -23,6 +23,9 @@ def go_test(
23
23
  False, "--export-verbose", help="log roundtrips when exporting the mock-tf-log"
24
24
  ),
25
25
  env_method: GoEnvVars = typer.Option(GoEnvVars.manual, "--env", help="|".join(list(GoEnvVars))),
26
+ names: list[str] = typer.Option(
27
+ ..., "-n", "--names", default_factory=list, help="run only the tests with these names"
28
+ ),
26
29
  ):
27
30
  if export_mock_tf_log and mode != GoTestMode.individual:
28
31
  err_msg = "exporting mock-tf-log is only supported for individual tests"
@@ -50,6 +53,7 @@ def go_test(
50
53
  concurrent_runs=concurrent_runs,
51
54
  re_run=re_run,
52
55
  env_vars=env_method,
56
+ names=set(names),
53
57
  )
54
58
  case _:
55
59
  raise NotImplementedError
@@ -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 []
@@ -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 package_modifiers, package_skip_suffixes
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
- return default_is_diff(rt) and not any(rt.request.path.endswith(suffix) for suffix in self.diff_skip_suffixes)
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: atlas-init
3
- Version: 0.3.4
3
+ Version: 0.3.6
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=2WaRI0pCJs3nKsbAgEt7upEnc9JyUA4G-ZqVJG0Jh5U,372
1
+ atlas_init/__init__.py,sha256=013oNfbE-2O9o7wGJ0RfU_mp9JM2EfwATjKXG2D_v6I,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
@@ -13,25 +13,25 @@ atlas_init/cli_cfn/cfn_parameter_finder.py,sha256=tAadNF1M_U2BTY-m9fXVXFXNQRvfud
13
13
  atlas_init/cli_cfn/example.py,sha256=pQNpFreuv58O3lanLy5Kunp8GxG8i9PWjuWsYlpv2tg,8320
14
14
  atlas_init/cli_cfn/files.py,sha256=vjop9G8rGMgyRe4fX5eWNX5H-YGAmk-fNUqUGErI7xg,1720
15
15
  atlas_init/cli_helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- atlas_init/cli_helper/go.py,sha256=727Rh881pU5w1ZXBmDGt6ep0yvjRVpIBUL80BZyT0O8,8221
16
+ atlas_init/cli_helper/go.py,sha256=_ytiX-EUqdZdBvzchQVRmlbrbbdXw4sf_FJdsCtffb8,8412
17
17
  atlas_init/cli_helper/run.py,sha256=njE_ua8x_glOo6eOGa4NgZqpLcqOo3eALydrZ0bCXW4,3486
18
18
  atlas_init/cli_helper/sdk.py,sha256=exh58-VZwxtosaxM269C62EEy1VnpJPOVziPDPkGsmE,2983
19
19
  atlas_init/cli_helper/sdk_auto_changes.py,sha256=oWyXw7P0PdO28hclRvza_RcIVXAyzu0lCYTJTNBDMeo,189
20
20
  atlas_init/cli_helper/tf_runner.py,sha256=OYdC-Y6i-xRh8_LCudKdtP7CEYEO9e67nVhholN29eg,3636
21
21
  atlas_init/cli_root/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- atlas_init/cli_root/go_test.py,sha256=1MgBjT1qXmJAbL0Z-REm64hVN4qFLBEVTr0zwuivlyc,4265
22
+ atlas_init/cli_root/go_test.py,sha256=tWQgIoL2K1XdQfvU7wlA1ckBULfC9XrrF6SUs928KWg,4438
23
23
  atlas_init/cli_root/trigger.py,sha256=oEgqb_l25tyYgUaFHEuChcOCJA7k3mnRa4D-Myz-Igs,5789
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
27
  atlas_init/cli_tf/debug_logs.py,sha256=q71ZNOnQOz1ikPCyqUz_6zyd4Bm1QVkCkTcixJBZ1xI,8988
28
28
  atlas_init/cli_tf/debug_logs_test_data.py,sha256=G4pnuWJ7PAQd3NXRKAtwAPC6Ne-PgpzaTZHQ9waqxZI,9565
29
- atlas_init/cli_tf/debug_logs_test_data_package_config.py,sha256=0GB-m8l9TWL4vstnFVO2jw5Jvtlz9WfHTp-9RmaPugw,1473
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=311sUVpxbvcz6Qdpz2Z1kFQm67zfjs4aUsQOKrJ2LrY,6988
34
+ atlas_init/cli_tf/mock_tf_log.py,sha256=rYUpkN1oOWk1ncy99J-Jb9p7wL073XnO-PdfFRnYnR8,7533
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.4.dist-info/METADATA,sha256=bur5W1zMSSpw_8NmQhrI5Ban1vNVzmVdRu6J-tJB_co,5650
92
- atlas_init-0.3.4.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
93
- atlas_init-0.3.4.dist-info/entry_points.txt,sha256=oSNFIEAS9nUZyyZ8Fc-0F0U5j-NErygy01LpJVSHapQ,57
94
- atlas_init-0.3.4.dist-info/RECORD,,
91
+ atlas_init-0.3.6.dist-info/METADATA,sha256=OZjhfNhuqps6Lj0ula1qtEaeEqToxHMvkisBrWezRcM,5650
92
+ atlas_init-0.3.6.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
93
+ atlas_init-0.3.6.dist-info/entry_points.txt,sha256=oSNFIEAS9nUZyyZ8Fc-0F0U5j-NErygy01LpJVSHapQ,57
94
+ atlas_init-0.3.6.dist-info/RECORD,,