atlas-init 0.3.3__py3-none-any.whl → 0.3.5__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.3"
3
+ VERSION = "0.3.5"
4
4
 
5
5
 
6
6
  def running_in_repo() -> bool:
@@ -57,6 +57,7 @@ test_suites:
57
57
  vars:
58
58
  use_project_extra: true
59
59
  - name: resource_policy
60
+ sequential_tests: true
60
61
  repo_go_packages:
61
62
  cfn:
62
63
  - cfn-resources/resource-policy
@@ -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):
@@ -79,12 +80,18 @@ def run_go_tests(
79
80
  logger.warning(f"no go packages for suite: {group}")
80
81
  continue
81
82
  if mode == GoTestMode.individual:
83
+ if group.sequential_tests:
84
+ logger.info(f"running individual tests sequentially as {group.name} is set to sequential_tests")
85
+ concurrent_runs = 1
82
86
  test_names = find_individual_tests(repo_path, package_paths)
83
87
  for name, pkg_path in test_names.items():
88
+ if names and name not in names:
89
+ continue
84
90
  results.add_test_package_path(name, pkg_path)
85
91
  commands_to_run[name] = f"go test {packages} -v -run ^{name}$ -timeout {timeout_minutes}m"
86
92
  elif mode == GoTestMode.package:
87
- 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"
88
95
  if not group.sequential_tests:
89
96
  command = f"{command} -parallel {concurrent_runs}"
90
97
  commands_to_run[group.name] = command
@@ -19,7 +19,13 @@ def go_test(
19
19
  concurrent_runs: int = typer.Option(20, "-c", "--concurrent", help="number of concurrent runs"),
20
20
  re_run: bool = typer.Option(False, "-r", "--re-run", help="re-run the tests if the log already exist"),
21
21
  export_mock_tf_log: bool = typer.Option(False, "-e", "--export", help="export the mock-tf-log"),
22
+ export_mock_tf_log_verbose: bool = typer.Option(
23
+ False, "--export-verbose", help="log roundtrips when exporting the mock-tf-log"
24
+ ),
22
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
+ ),
23
29
  ):
24
30
  if export_mock_tf_log and mode != GoTestMode.individual:
25
31
  err_msg = "exporting mock-tf-log is only supported for individual tests"
@@ -47,6 +53,7 @@ def go_test(
47
53
  concurrent_runs=concurrent_runs,
48
54
  re_run=re_run,
49
55
  env_vars=env_method,
56
+ names=set(names),
50
57
  )
51
58
  case _:
52
59
  raise NotImplementedError
@@ -54,12 +61,12 @@ def go_test(
54
61
  error_msg = "no results found"
55
62
  raise ValueError(error_msg)
56
63
  if export_mock_tf_log:
57
- _export_mock_tf_logs(results)
64
+ _export_mock_tf_logs(results, export_mock_tf_log_verbose)
58
65
  # use the test_results: dict[str, list[GoTestRun]]
59
66
  # TODO: create_detailed_summary()
60
67
 
61
68
 
62
- def _export_mock_tf_logs(results: GoTestResult):
69
+ def _export_mock_tf_logs(results: GoTestResult, verbose: bool):
63
70
  package_paths = results.test_name_package_path
64
71
  admin_api_path = resolve_admin_api_path("", sdk_branch="main", admin_api_path="")
65
72
  for test_name, runs in results.runs.items():
@@ -78,11 +85,15 @@ def _export_mock_tf_logs(results: GoTestResult):
78
85
  tpf_package_path = default_package_path
79
86
  tf_log_path = run.log_path
80
87
  assert tf_log_path, f"test didn't set tf_log_path: {test_name}"
88
+ if test_name in results.failure_names:
89
+ logger.warning(f"test_name={test_name} failed, not exporting mock-tf-log")
90
+ continue
81
91
  req = MockTFLog(
82
92
  log_path=tf_log_path,
83
93
  output_dir=tpf_package_path,
84
94
  admin_api_path=admin_api_path,
85
95
  package_name=package_path.name,
96
+ log_diff_roundtrips=verbose,
86
97
  )
87
98
  mocked_yaml = mock_tf_log(req)
88
99
  logger.info(f"mocked TestConfig saved to {mocked_yaml}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: atlas-init
3
- Version: 0.3.3
3
+ Version: 0.3.5
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,6 +1,6 @@
1
- atlas_init/__init__.py,sha256=x8cFU0CpX_K9Ha_EhynKLP9QaJvcEH7phPh9svYKiZI,372
1
+ atlas_init/__init__.py,sha256=bmmvmAoWZR99QstJeXgp8n5fDtO2RL8UYwdJpDBOnj8,372
2
2
  atlas_init/__main__.py,sha256=dY1dWWvwxRZMmnOFla6RSfti-hMeLeKdoXP7SVYqMUc,52
3
- atlas_init/atlas_init.yaml,sha256=6UC10VjXpn80RMtn-LsuJ-Ghoql5KBWKgzs3BixHfIo,2040
3
+ atlas_init/atlas_init.yaml,sha256=OAosOZw4kjhTWcPeEv0jtztRFWRhsie8D9r5afySAxM,2065
4
4
  atlas_init/cli.py,sha256=xOnAOUccHDLkivICdF0GsLhccr_IxvnTKTbe1KGW7kU,8971
5
5
  atlas_init/cli_args.py,sha256=tiwUYAE0JBSl9lHV6VJ41vFCU90ChBZ4mKvi-YoF_HY,541
6
6
  atlas_init/humps.py,sha256=l0ZXXuI34wwd9TskXhCjULfGbUyK-qNmiyC6_2ow6kU,7339
@@ -13,13 +13,13 @@ 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=ulRjwQ9JVXAd0FUgZJ1gPzeINx0B9FH9jUZ1O7Skilk,8033
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=K8N-EIgry21ILYGJqj5Y7kjPXPl4UTOS9WDk3m3nhjY,3878
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
@@ -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.3.dist-info/METADATA,sha256=0BLRaxcC3IeB3umJ-rcNN3xRRrkspbSVMPOrLbmozhk,5650
92
- atlas_init-0.3.3.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
93
- atlas_init-0.3.3.dist-info/entry_points.txt,sha256=oSNFIEAS9nUZyyZ8Fc-0F0U5j-NErygy01LpJVSHapQ,57
94
- atlas_init-0.3.3.dist-info/RECORD,,
91
+ atlas_init-0.3.5.dist-info/METADATA,sha256=1JS-oOF2C-MZatON3IcBf3QlOC_KVuU0Xl61MBWEYco,5650
92
+ atlas_init-0.3.5.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
93
+ atlas_init-0.3.5.dist-info/entry_points.txt,sha256=oSNFIEAS9nUZyyZ8Fc-0F0U5j-NErygy01LpJVSHapQ,57
94
+ atlas_init-0.3.5.dist-info/RECORD,,