@@ -243,6 +243,51 @@ def test_get_deployment_replicaset(self):
243243 data
244244 )
245245
246+ def test_get_deployment_annotations (self ):
247+ """
248+ Look at the annotations on the Deployment object
249+ """
250+ # test success
251+ kwargs = {
252+ 'spec_annotations' : {'iam.amazonaws.com/role' : 'role-arn' },
253+ }
254+ deployment = self .create (** kwargs )
255+ data = self .scheduler .deployment .get (self .namespace , deployment ).json ()
256+
257+ self .assertDictContainsSubset (
258+ {
259+ 'iam.amazonaws.com/role' : 'role-arn'
260+ },
261+ data ['spec' ]['template' ]['metadata' ]['annotations' ]
262+ )
263+
264+ def test_get_pod_annotations (self ):
265+ """
266+ Look at the Pod annotations that the Deployment created
267+ """
268+ kwargs = {
269+ 'spec_annotations' : {
270+ 'iam.amazonaws.com/role' : 'role-arn-pods' ,
271+ 'nginx.ingress.kubernetes.io/app-root' : '/rootfs' ,
272+ 'sidecar.istio.io/inject' : 'true'
273+ },
274+ }
275+ deployment = self .create (** kwargs )
276+ data = self .scheduler .deployment .get (self .namespace , deployment ).json ()
277+ self .assertEqual (data ['kind' ], 'Deployment' )
278+ self .assertEqual (data ['metadata' ]['name' ], deployment )
279+
280+ labels = {'app' : self .namespace , 'version' : 'v99' , 'type' : 'web' }
281+ pods = self .scheduler .pod .get (self .namespace , labels = labels ).json ()
282+ self .assertDictEqual (
283+ {
284+ 'iam.amazonaws.com/role' : 'role-arn-pods' ,
285+ 'nginx.ingress.kubernetes.io/app-root' : '/rootfs' ,
286+ 'sidecar.istio.io/inject' : 'true'
287+ },
288+ pods ['items' ][0 ]['metadata' ]['annotations' ]
289+ )
290+
246291 def test_check_for_failed_events (self ):
247292 deploy_name = self .create (self .namespace )
248293 deployment = self .scheduler .deployment .get (self .namespace , deploy_name ).json ()
0 commit comments