Merge pull request #39088 from kargakis/unit-tests-for-the-d-controller

Automatic merge from submit-queue (batch tested with PRs 39483, 39088, 38787)

controller: unit tests for overlapping and recreate deployments

Belated unit tests for https://github.com/kubernetes/kubernetes/pull/38080 and https://github.com/kubernetes/kubernetes/pull/36748.

@kubernetes/sig-apps-misc
This commit is contained in:
Kubernetes Submit Queue
2017-01-11 15:35:46 -08:00
committed by GitHub
5 changed files with 412 additions and 24 deletions

View File

@@ -1003,7 +1003,7 @@ func DeploymentDeepCopy(deployment *extensions.Deployment) (*extensions.Deployme
}
// SelectorUpdatedBefore returns true if the former deployment's selector
// is updated before the latter, false otherwise
// is updated before the latter, false otherwise.
func SelectorUpdatedBefore(d1, d2 *extensions.Deployment) bool {
t1, t2 := LastSelectorUpdate(d1), LastSelectorUpdate(d2)
return t1.Before(t2)
@@ -1013,7 +1013,7 @@ func SelectorUpdatedBefore(d1, d2 *extensions.Deployment) bool {
func LastSelectorUpdate(d *extensions.Deployment) metav1.Time {
t := d.Annotations[SelectorUpdateAnnotation]
if len(t) > 0 {
parsedTime, err := time.Parse(t, time.RFC3339)
parsedTime, err := time.Parse(time.RFC3339, t)
// If failed to parse the time, use creation timestamp instead
if err != nil {
return d.CreationTimestamp