@@ -841,27 +841,38 @@ var _ = g.Describe("deploymentconfigs", func() {
841
841
o .Expect (waitForLatestCondition (oc , "history-limit" , deploymentRunTimeout , deploymentReachedCompletion )).NotTo (o .HaveOccurred ())
842
842
o .Expect (waitForSyncedConfig (oc , "history-limit" , deploymentRunTimeout )).NotTo (o .HaveOccurred (),
843
843
"the controller needs to have synced with the updated deployment configuration before checking that the revision history limits are being adhered to" )
844
- deploymentConfig , deploymentsv1 , _ , err := deploymentInfo (oc , "history-limit" )
845
- o .Expect (err ).NotTo (o .HaveOccurred ())
846
- // sanity check to ensure that the following asertion on the amount of old deployments is valid
847
- o .Expect (* deploymentConfig .Spec .RevisionHistoryLimit ).To (o .Equal (int32 (revisionHistoryLimit )))
848
-
849
- // we need to filter out any deployments that we don't care about,
850
- // namely the active deployment and any newer deployments
851
- // TODO: get rid of ugly conversion by porting the deploymentconfig controller to v1 RCs
852
- deployments := make ([]* kapi.ReplicationController , len (deploymentsv1 ))
853
- for i := range deploymentsv1 {
854
- deployments [i ] = & kapi.ReplicationController {}
855
- v1 .Convert_v1_ReplicationController_To_api_ReplicationController (deploymentsv1 [i ], deployments [i ], nil )
856
- }
857
- oldDeployments := deployutil .DeploymentsForCleanup (deploymentConfig , deployments )
844
+ var pollErr error
845
+ err = wait .PollImmediate (1 * time .Second , 1 * time .Minute , func () (bool , error ) {
846
+ deploymentConfig , deploymentsv1 , _ , err := deploymentInfo (oc , "history-limit" )
847
+ if err != nil {
848
+ pollErr = err
849
+ return false , nil
850
+ }
851
+
852
+ // we need to filter out any deployments that we don't care about,
853
+ // namely the active deployment and any newer deployments
854
+ // TODO: get rid of ugly conversion by porting the deploymentconfig controller to v1 RCs
855
+ deployments := make ([]* kapi.ReplicationController , len (deploymentsv1 ))
856
+ for i := range deploymentsv1 {
857
+ deployments [i ] = & kapi.ReplicationController {}
858
+ v1 .Convert_v1_ReplicationController_To_api_ReplicationController (deploymentsv1 [i ], deployments [i ], nil )
859
+ }
860
+ oldDeployments := deployutil .DeploymentsForCleanup (deploymentConfig , deployments )
858
861
859
- // we should not have more deployments than acceptable
860
- o .Expect (len (oldDeployments )).To (o .BeNumerically ("==" , revisionHistoryLimit ))
862
+ // we should not have more deployments than acceptable
863
+ if len (oldDeployments ) != revisionHistoryLimit {
864
+ pollErr = fmt .Errorf ("expected len of old deployments: %d to equal dc revisionHistoryLimit: %d" , len (oldDeployments ), revisionHistoryLimit )
865
+ return false , nil
866
+ }
861
867
862
- // the deployments we continue to keep should be the latest ones
863
- for _ , deployment := range oldDeployments {
864
- o .Expect (deployutil .DeploymentVersionFor (& deployment )).To (o .BeNumerically (">=" , iterations - revisionHistoryLimit ))
868
+ // the deployments we continue to keep should be the latest ones
869
+ for _ , deployment := range oldDeployments {
870
+ o .Expect (deployutil .DeploymentVersionFor (& deployment )).To (o .BeNumerically (">=" , iterations - revisionHistoryLimit ))
871
+ }
872
+ return true , nil
873
+ })
874
+ if err == wait .ErrWaitTimeout {
875
+ o .Expect (pollErr ).NotTo (o .HaveOccurred ())
865
876
}
866
877
})
867
878
})
0 commit comments