11"""Test notification system deployment and functionality."""
22
33import json
4+ import os
45import subprocess
56import time
67
910
1011def test_eoapi_notifier_deployment ():
1112 """Test that eoapi-notifier deployment is running."""
13+ # Get namespace from environment variable
14+ namespace = os .environ .get ("NAMESPACE" , "eoapi" )
15+
1216 # Check if eoapi-notifier deployment exists and is ready
1317 result = subprocess .run (
1418 [
@@ -18,7 +22,7 @@ def test_eoapi_notifier_deployment():
1822 "-l" ,
1923 "app.kubernetes.io/name=eoapi-notifier" ,
2024 "-n" ,
21- "eoapi" ,
25+ namespace ,
2226 "--no-headers" ,
2327 "-o" ,
2428 "custom-columns=READY:.status.readyReplicas" ,
@@ -40,6 +44,9 @@ def test_eoapi_notifier_deployment():
4044
4145def test_cloudevents_sink_exists ():
4246 """Test that Knative CloudEvents sink service exists and is accessible."""
47+ # Get namespace from environment variable
48+ namespace = os .environ .get ("NAMESPACE" , "eoapi" )
49+
4350 # Check if Knative service exists
4451 result = subprocess .run (
4552 [
@@ -48,6 +55,8 @@ def test_cloudevents_sink_exists():
4855 "ksvc" ,
4956 "-l" ,
5057 "app.kubernetes.io/component=cloudevents-sink" ,
58+ "-n" ,
59+ namespace ,
5160 "--no-headers" ,
5261 ],
5362 capture_output = True ,
@@ -66,6 +75,9 @@ def test_cloudevents_sink_exists():
6675
6776def test_notification_configuration ():
6877 """Test that eoapi-notifier is configured correctly."""
78+ # Get namespace from environment variable
79+ namespace = os .environ .get ("NAMESPACE" , "eoapi" )
80+
6981 # Get the configmap for eoapi-notifier
7082 result = subprocess .run (
7183 [
@@ -74,6 +86,8 @@ def test_notification_configuration():
7486 "configmap" ,
7587 "-l" ,
7688 "app.kubernetes.io/name=eoapi-notifier" ,
89+ "-n" ,
90+ namespace ,
7791 "-o" ,
7892 r"jsonpath={.items[0].data.config\.yaml}" ,
7993 ],
@@ -96,6 +110,9 @@ def test_notification_configuration():
96110
97111def test_cloudevents_sink_logs_show_startup ():
98112 """Test that Knative CloudEvents sink started successfully."""
113+ # Get namespace from environment variable
114+ namespace = os .environ .get ("NAMESPACE" , "eoapi" )
115+
99116 # Get Knative CloudEvents sink pod logs
100117 result = subprocess .run (
101118 [
@@ -104,7 +121,7 @@ def test_cloudevents_sink_logs_show_startup():
104121 "-l" ,
105122 "serving.knative.dev/service" ,
106123 "-n" ,
107- "eoapi" ,
124+ namespace ,
108125 "--tail=20" ,
109126 ],
110127 capture_output = True ,
0 commit comments