Skip to content

Commit 5a06159

Browse files
committed
Add 'config' file to ensure 'safeBackup' files are not generated
* Add 'config' file to ensure 'safeBackup' files are not generated
1 parent ff8ebc1 commit 5a06159

1 file changed

Lines changed: 40 additions & 5 deletions

File tree

ci/e2e/testcases/tc0002_sync_list_validation.py

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,23 @@ def run(self, context: E2EContext) -> TestResult:
193193
reset_directory(sync_root)
194194

195195
copied_refresh_token = context.bootstrap_config_dir(config_dir)
196+
197+
config_path = config_dir / CONFIG_FILE_NAME
198+
existing_config_text = (
199+
config_path.read_text(encoding="utf-8") if config_path.exists() else ""
200+
)
201+
base_config_text = self._build_base_config_text(existing_config_text)
202+
write_text_file(config_path, base_config_text)
203+
196204
context.log(
197205
f"Scenario {scenario.scenario_id} bootstrapped config dir: {config_dir}"
198206
)
207+
context.log(
208+
f"Scenario {scenario.scenario_id} wrote tc0002 base config: {config_path}"
209+
)
199210

200211
shutil.copytree(fixture_root, sync_root, dirs_exist_ok=True)
201212

202-
config_path = config_dir / CONFIG_FILE_NAME
203-
base_config_text = config_path.read_text(encoding="utf-8") if config_path.exists() else ""
204-
205213
sync_list_path = config_dir / "sync_list"
206214
metadata_file = scenario_dir / "metadata.txt"
207215
actual_manifest_file = scenario_dir / "actual_manifest.txt"
@@ -211,11 +219,19 @@ def run(self, context: E2EContext) -> TestResult:
211219
f"scenario_id={scenario.scenario_id}",
212220
f"description={scenario.description}",
213221
f"config_dir={config_dir}",
222+
f"config_path={config_path}",
214223
f"refresh_token_path={copied_refresh_token}",
215224
f"execution_mode={scenario.execution_mode}",
216225
]
217226

218-
all_artifacts.extend([str(sync_list_path), str(metadata_file), str(actual_manifest_file)])
227+
all_artifacts.extend(
228+
[
229+
str(config_path),
230+
str(sync_list_path),
231+
str(metadata_file),
232+
str(actual_manifest_file),
233+
]
234+
)
219235

220236
if scenario.execution_mode == "cleanup_regression":
221237
diffs, artifacts, extra_metadata = self._run_cleanup_regression_scenario(
@@ -285,6 +301,25 @@ def run(self, context: E2EContext) -> TestResult:
285301
details=details,
286302
)
287303

304+
def _build_base_config_text(self, existing_config_text: str = "") -> str:
305+
sections: list[str] = []
306+
307+
existing_config_text = existing_config_text.strip("\n")
308+
if existing_config_text.strip():
309+
sections.append(existing_config_text)
310+
311+
sections.append(
312+
"\n".join(
313+
[
314+
"# tc0002 base config",
315+
'bypass_data_preservation = "true"',
316+
'skip_file = "~*|.~*|*.tmp|*.swp|*.partial|*-safeBackup-*"',
317+
]
318+
)
319+
)
320+
321+
return "\n\n".join(sections).rstrip("\n") + "\n"
322+
288323
def _run_standard_scenario(
289324
self,
290325
context: E2EContext,
@@ -1585,4 +1620,4 @@ def _build_scenarios(self) -> list[SyncListScenario]:
15851620
f"{FIXTURE_ROOT_NAME}/Projects/Code/JOBXYZ/Exports/file.wav",
15861621
],
15871622
),
1588-
]
1623+
]

0 commit comments

Comments
 (0)