New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AIRFLOW-3251] KubernetesPodOperator does not use 'image_pull_secrets… #4188
[AIRFLOW-3251] KubernetesPodOperator does not use 'image_pull_secrets… #4188
Conversation
Would you be able to add some unit tests to ensure that the values are passed down appropriately? |
@ashb yes, but I'm not familiar with the tests of airflow. Where should they reside? In |
@ashb or I can test that a failure happen when an incorrect |
9cd4279
to
5377e70
Compare
Something like https://github.com/apache/incubator-airflow/blob/master/tests/contrib/minikube/test_kubernetes_pod_operator.py#L63-L85 (the mocking) looks like it would do. |
@ashb for now I've implemented a test that checks that a failure happen if there is an incorrect Sorry I'm not very familiar with python unit testing framework :) |
Codecov Report
@@ Coverage Diff @@
## master #4188 +/- ##
=========================================
+ Coverage 77.69% 77.7% +<.01%
=========================================
Files 199 199
Lines 16309 16309
=========================================
+ Hits 12672 12673 +1
+ Misses 3637 3636 -1
Continue to review full report at Codecov.
|
startup_timeout_seconds=5, | ||
image_pull_secrets=bad_image_pull_secrets | ||
) | ||
with self.assertRaises(ApiException): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test alone seems a little bit hard-to-reason about.
Could you do something like assertRaisesRegexp(ApiException, r'invalid pull secrets')
(or what ever string indicates the pull secrets are the problem - try to make it not too specific.) And perhaps a comment too so we know what this test was trying to test if it fails in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, anyway this doesn't work apparently, if it is not needed, the pull secret is not used it seems, I will think of another way to test this
5377e70
to
bbd6801
Compare
bbd6801
to
b7bd02d
Compare
@ashb I have finally added a test using the mock to validate that the pod operator properly set the parameter on the pod. |
…gument when creating Pods (apache#4188)
…gument when creating Pods (apache#4188) (cherry picked from commit 2b707ab)
…gument when creating Pods (#4188)
…gument when creating Pods (apache#4188)
…gument when creating Pods (apache#4188)
…gument when creating Pods (#4188)
…gument when creating Pods (apache#4188)
…gument when creating Pods (apache#4188)
…' argument
Make sure you have checked all steps below.
Jira
Description
I have chosen to not modify how image_pull_secrets were handled by
KubernetesRequestFactory.extract_image_pull_secrets
and so the pod operator takes astr
and not alist str
.