Skip to content

Commit

Permalink
Delete PVCs from auto provisioned Jaeger at end of test (#881)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Earls <[email protected]>
  • Loading branch information
kevinearls authored Feb 5, 2020
1 parent 80f7855 commit dc0b118
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/e2e/self_provisioned_elasticsearch_kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (suite *SelfProvisionedTestSuite) TestSelfProvisionedESAndKafkaSmokeTest()
err := fw.Client.Create(goctx.TODO(), exampleJaeger, &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval})
require.NoError(t, err, "Error deploying example Jaeger")
defer undeployJaegerInstance(exampleJaeger)
defer deletePersistentVolumeClaims(namespace)

err = WaitForStatefulset(t, fw.KubeClient, namespace, jaegerInstanceName+"-zookeeper", retryInterval, timeout+1*time.Minute)
require.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/streaming_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func (suite *StreamingTestSuite) TestStreamingWithAutoProvisioning() {
err := fw.Client.Create(context.TODO(), jaegerInstance, &framework.CleanupOptions{TestContext: ctx, Timeout: timeout, RetryInterval: retryInterval})
require.NoError(t, err, "Error deploying jaeger")
defer undeployJaegerInstance(jaegerInstance)
defer deletePersistentVolumeClaims(namespace)

err = WaitForStatefulset(t, fw.KubeClient, namespace, jaegerInstanceName+"-zookeeper", retryInterval, timeout+1*time.Minute)
require.NoError(t, err)
Expand Down
11 changes: 11 additions & 0 deletions test/e2e/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,14 @@ func createSecret(secretName, secretNamespace string, secretData map[string][]by
WaitForSecret(secretName, secretNamespace)
return createdSecret
}

func deletePersistentVolumeClaims(namespace string) {
pvcs, err := fw.KubeClient.CoreV1().PersistentVolumeClaims(kafkaNamespace).List(metav1.ListOptions{})
require.NoError(t, err)

emptyDeleteOptions := metav1.DeleteOptions{}
for _, pvc := range pvcs.Items {
logrus.Infof("Deleting PVC %s from namespace %s", pvc.Name, namespace)
fw.KubeClient.CoreV1().PersistentVolumeClaims(kafkaNamespace).Delete(pvc.Name, &emptyDeleteOptions)
}
}

0 comments on commit dc0b118

Please sign in to comment.