Skip to content

Commit

Permalink
Remove erroneous unit tests
Browse files Browse the repository at this point in the history
Previously, the await logic required the "Progressing" status
to be present. However, the `extensions/v1beta1` Deployment
object does not ever have this status set, so this was an
erroneous assumption. The await logic was updated to handle
cases where this status field is missing, and it should still detect
failure properly.
  • Loading branch information
lblackstone committed Jul 23, 2019
1 parent a9a1577 commit 69c3083
Showing 1 changed file with 0 additions and 97 deletions.
97 changes: 0 additions & 97 deletions pkg/await/apps_deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,27 +356,6 @@ func Test_Apps_Deployment(t *testing.T) {
timeout <- time.Now()
},
},
{
description: "[Revision 2] Deployment should fail if 'Progressing' condition is missing",
do: func(deployments, replicaSets, pods chan watch.Event, timeout chan time.Time) {
// User submits a deployment. In the first revision, the "Progressing" condition is
// not reported, because nothing is rolling out -- the ReplicaSet need only be
// created and become available.
deployments <- watchAddedEvent(
deploymentAdded(inputNamespace, deploymentInputName, revision2))
deployments <- watchAddedEvent(
deploymentRevision2Created(inputNamespace, deploymentInputName))
replicaSets <- watchAddedEvent(
availableReplicaSet(inputNamespace, replicaSetGeneratedName, deploymentInputName, revision2))

// Timeout. Failure.
timeout <- time.Now()
},
expectedError: &timeoutError{
object: deploymentRevision2Created(inputNamespace, deploymentInputName),
subErrors: []string{
"Minimum number of Pods to consider the application live was not attained"}},
},
{
description: "[Revision 2] Deployment should fail if Deployment reports 'Progressing' failure",
do: func(deployments, replicaSets, pods chan watch.Event, timeout chan time.Time) {
Expand Down Expand Up @@ -815,16 +794,6 @@ func Test_Core_Deployment_Read(t *testing.T) {
replicaset: availableReplicaSet,
replicaSetRevision: revision1,
},
{
description: "[Revision 2] Read should fail if Deployment available but no progressing status",
deployment: func(namespace, name, _ string) *unstructured.Unstructured {
return deploymentRevision2Created(namespace, name)
},
replicaset: availableReplicaSet,
replicaSetRevision: revision2,
expectedSubErrors: []string{
"Minimum number of Pods to consider the application live was not attained"},
},
{
description: "[Revision 2] Read should succeed if rollout completes",
deployment: deploymentRolloutComplete,
Expand Down Expand Up @@ -1316,72 +1285,6 @@ func deploymentRevision1Created(namespace, name string) *unstructured.Unstructur
return obj
}

// deploymentRevision2Created differs from `deploymentRevision1Created` only in the revision being 2
// instead of 1. Because the 'Progressing' condition is missing, this should cause a failure.
func deploymentRevision2Created(namespace, name string) *unstructured.Unstructured {
obj, err := decodeUnstructured(fmt.Sprintf(`{
"kind": "Deployment",
"apiVersion": "apps/v1",
"metadata": {
"namespace": "%s",
"name": "%s",
"generation": 1,
"labels": {
"app": "foo"
},
"annotations": {
"deployment.kubernetes.io/revision": "2",
"pulumi.com/autonamed": "true"
}
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"app": "foo"
}
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app": "foo"
}
},
"spec": {
"containers": [
{
"name": "nginx",
"image": "nginx"
}
]
}
}
},
"status": {
"observedGeneration": 1,
"replicas": 1,
"updatedReplicas": 1,
"readyReplicas": 1,
"availableReplicas": 1,
"conditions": [
{
"type": "Available",
"status": "True",
"lastUpdateTime": "2018-07-31T21:49:11Z",
"lastTransitionTime": "2018-07-31T21:49:11Z",
"reason": "MinimumReplicasAvailable",
"message": "Deployment has minimum availability."
}
]
}
}`, namespace, name))
if err != nil {
panic(err)
}
return obj
}

func deploymentRolloutComplete(namespace, name, revision string) *unstructured.Unstructured {
obj, err := decodeUnstructured(fmt.Sprintf(`{
"kind": "Deployment",
Expand Down

0 comments on commit 69c3083

Please sign in to comment.