unrip/test/ntfy_manifest_test.py
philipp c5a214ce06
Some checks failed
deploy / deploy (push) Failing after 3m30s
Notify on durable fund and trade outcomes
Proof: npm test; npm run operator-dashboard:build; PYTHONPATH=. python3 test/render_release_manifest_test.py; PYTHONPATH=. python3 test/repo_deployments_test.py; PYTHONPATH=. python3 test/ntfy_manifest_test.py; kubectl kustomize deploy/k8s/base.

Assumptions: notifications should be emitted by history-writer after durable writes and outcome refreshes, and only for credited deposits, completed withdrawals, and completed trades with linked inventory movement evidence.

Still fake: Generic alert notification policy is not re-enabled; withdrawal submitted notifications are not emitted; old historical outcomes are not backfilled as notifications; fee-complete realized PnL is still unavailable.
2026-04-16 14:23:29 +02:00

33 lines
1.5 KiB
Python

import pathlib
import unittest
ROOT = pathlib.Path(__file__).resolve().parents[1]
class NtfyManifestTest(unittest.TestCase):
def test_app_kustomization_does_not_own_cluster_ntfy_resources(self):
source = (ROOT / 'deploy/k8s/base/kustomization.yaml').read_text()
self.assertNotIn('utility-namespace.yaml', source)
self.assertNotIn('ntfy.yaml', source)
self.assertFalse((ROOT / 'deploy/k8s/base/utility-namespace.yaml').exists())
self.assertFalse((ROOT / 'deploy/k8s/base/ntfy.yaml').exists())
def test_unrip_services_receive_internal_notification_endpoint(self):
source = (ROOT / 'deploy/k8s/base/unrip.yaml').read_text()
self.assertIn('NOTIFICATION_NTFY_BASE_URL: http://ntfy.utility.svc.cluster.local', source)
self.assertIn('NOTIFICATION_NTFY_TOPIC: unrip', source)
def test_app_workflow_does_not_wait_on_cluster_owned_ntfy(self):
source = (ROOT / '.forgejo/workflows/deploy.yml').read_text()
self.assertNotIn('deployment/ntfy', source)
def test_notification_token_is_secret_bootstrap_only(self):
manifest = (ROOT / 'deploy/k8s/base/unrip.yaml').read_text()
self.assertNotIn('NOTIFICATION_NTFY_TOKEN:', manifest)
bootstrap = (ROOT / 'scripts/deploy/bootstrap.sh').read_text()
self.assertIn('NOTIFICATION_NTFY_TOKEN', bootstrap)
self.assertIn('--from-literal=NOTIFICATION_NTFY_TOKEN=', bootstrap)
if __name__ == '__main__':
unittest.main()