Close verified incident task and finish local workplan loose ends
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a0e3c3-621b-7350-9f77-50a8d3ee7657
This commit is contained in:
parent
5781d34b3b
commit
debf981097
22 changed files with 1210 additions and 62 deletions
|
|
@ -67,6 +67,27 @@ def test_primary_validation_failure_has_terminal_time_without_credentials(tmp_pa
|
|||
times(json.loads(output.read_text()))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('profile', ['full', 'essentials', 'unsupported'])
|
||||
def test_primary_preserves_profile_before_credential_access(tmp_path, profile):
|
||||
encrypted = tmp_path/'source.zip.age'; encrypted.write_bytes(b'fixture')
|
||||
source = tmp_path/'source.json'; output = tmp_path/'receipt.json'
|
||||
source.write_text(json.dumps(dict(status='offsite_fetched_pending_isolated_restore',
|
||||
archive_profile=profile, ciphertext_sha256=hashlib.sha256(b'fixture').hexdigest())))
|
||||
with patch.object(sys, 'argv', ['primary', '--source', str(encrypted),
|
||||
'--source-receipt', str(source), '--output', str(tmp_path/'download'),
|
||||
'--receipt', str(output), '--kubeconfig', 'unused']), \
|
||||
patch.object(primary, 'assert_cluster', side_effect=RuntimeError('stop before credentials')) as cluster:
|
||||
assert primary.main() == 1
|
||||
receipt = json.loads(output.read_text())
|
||||
if profile == 'unsupported':
|
||||
cluster.assert_not_called()
|
||||
assert 'archive_profile' not in receipt
|
||||
else:
|
||||
cluster.assert_called_once()
|
||||
assert receipt['archive_profile'] == profile
|
||||
times(receipt)
|
||||
|
||||
|
||||
def test_decryption_keeps_own_schema_and_times(tmp_path):
|
||||
encrypted=tmp_path/'encrypted';encrypted.write_bytes(b'fixture')
|
||||
source=tmp_path/'source.json';source.write_text(json.dumps(dict(schema='platform.forgejo-primary-archive.v1',status='primary_fetched_pending_application_restore',download_hash_matches=True,ciphertext_sha256=hashlib.sha256(b'fixture').hexdigest(),started_at='2000-01-01T00:00:00Z',finished_at='2000-01-01T00:00:01Z')))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue