Skip to content

Commit efc0ff6

Browse files
committed
test: verify NZSHM22_THS_DISAGG_RLZ_DB s3:// value forwarded in docker wrapper
1 parent 73d1dae commit efc0ff6

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/test_docker_wrapper.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,29 @@ class R:
682682
assert has_env(captured['cmd'], 'NZSHM22_THS_RLZ_DB', 's3://my-bucket/path')
683683

684684

685+
def test_cli_docker_disagg_ths_s3_value_still_forwarded(mocker, tmp_path, monkeypatch):
686+
"""NZSHM22_THS_DISAGG_RLZ_DB s3:// value is forwarded via extra_env even though THS is not in the allowlist."""
687+
(tmp_path / 'foo.json').write_text('{}')
688+
monkeypatch.chdir(tmp_path)
689+
monkeypatch.setenv('NZSHM22_THS_DISAGG_RLZ_DB', 's3://my-disagg-bucket/path')
690+
691+
captured: dict = {}
692+
693+
def fake_run(cmd, check=False):
694+
captured['cmd'] = cmd
695+
696+
class R:
697+
returncode = 0
698+
699+
return R()
700+
701+
mocker.patch('runzi.cli.docker_wrapper._maybe_pull')
702+
mocker.patch('runzi.cli.docker_wrapper.subprocess.run', side_effect=fake_run)
703+
result = runner.invoke(app, ['--docker', 'hazard', 'oq-disagg', 'foo.json'])
704+
assert result.exit_code == 0
705+
assert has_env(captured['cmd'], 'NZSHM22_THS_DISAGG_RLZ_DB', 's3://my-disagg-bucket/path')
706+
707+
685708
def test_cli_docker_sets_user_env_in_container(mocker, tmp_path, monkeypatch):
686709
"""USER must be forwarded so getpass.getuser() doesn't fall back to pwd.getpwuid()."""
687710
(tmp_path / 'foo.json').write_text('{}')

0 commit comments

Comments
 (0)