PrithviBadiga commented on code in PR #65694:
URL: https://github.com/apache/airflow/pull/65694#discussion_r3127439475


##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/secrets/test_kubernetes_secrets_backend.py:
##########
@@ -134,6 +161,33 @@ def test_get_variable_not_found(self, mock_client, 
mock_namespace):
 
         assert result is None
 
+    @mock.patch(f"{MODULE_PATH}.namespace", new_callable=mock.PropertyMock, 
return_value="default")
+    @mock.patch(f"{MODULE_PATH}.client", new_callable=mock.PropertyMock)
+    def 
test_get_variable_falls_back_to_global_secret_when_team_secret_is_missing(
+        self, mock_client, mock_namespace
+    ):
+        mock_client.return_value.list_namespaced_secret.side_effect = [
+            _make_secret_list([]),
+            _make_secret_list([_make_secret({"value": "global-value"})]),

Review Comment:
   Good catch. I added a variable-side guard test as well to cover the 
team-scoped-key-accessed-as-global case.
   
   It now verifies that `get_variable("_teama___api_key")` returns `None` and 
that the Kubernetes client is not called.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to