Visitar URL original
Test exact staging maintenance window restoration · modelcontextprotocol/registry@6d42cbc · GitHub
Skip to content

Commit 6d42cbc

Browse files
committed
Test exact staging maintenance window restoration
1 parent d3e359b commit 6d42cbc

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎deploy/scripts/test_staging_small_apply.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import copy
22
import unittest
3+
from unittest.mock import patch
4+
from staging_small_apply import maintenance
35
from staging_small_apply import validate, APP, INGRESS, DATABASE, WORKERS, DATABASE_POOL, Blocked
46
from test_staging_idle_apply import step, preview
57

@@ -56,3 +58,17 @@ def test_never_changes_other_resources(self):
5658
validate(preview(step('unrelated', {}, {})), phase)
5759
with self.assertRaises(Blocked):
5860
validate({'steps': []}, phase)
61+
62+
63+
class MaintenanceRestoration(unittest.TestCase):
64+
def test_exact_previous_window_or_absence_is_restored(self):
65+
previous = {('default', 'registry-pg'): None, ('monitoring', 'grafana-pg'): {'inProgress': False, 'reusePVC': False}}
66+
with patch('staging_small_apply.kube', return_value={}) as call:
67+
maintenance(None, {}, previous)
68+
args = [c.args[0] for c in call.call_args_list]
69+
self.assertEqual(len(args), 2)
70+
import json
71+
first = json.loads(args[0][args[0].index('-p')+1])
72+
second = json.loads(args[1][args[1].index('-p')+1])
73+
self.assertEqual(first, [{'op': 'remove', 'path': '/spec/nodeMaintenanceWindow'}])
74+
self.assertEqual(second[0]['value'], previous[('monitoring', 'grafana-pg')])

0 commit comments

Comments
 (0)