diff --git a/test/e2e/self_provisioned_elasticsearch_kafka_test.go b/test/e2e/self_provisioned_elasticsearch_kafka_test.go index 11bab2240..4890b965d 100644 --- a/test/e2e/self_provisioned_elasticsearch_kafka_test.go +++ b/test/e2e/self_provisioned_elasticsearch_kafka_test.go @@ -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) diff --git a/test/e2e/streaming_test.go b/test/e2e/streaming_test.go index 06e521606..1bff1a210 100644 --- a/test/e2e/streaming_test.go +++ b/test/e2e/streaming_test.go @@ -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) diff --git a/test/e2e/utils.go b/test/e2e/utils.go index 2dcb6d99b..38801949d 100644 --- a/test/e2e/utils.go +++ b/test/e2e/utils.go @@ -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) + } +}