You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/03/06 22:56:46 UTC
[GitHub] [spark] Yikun commented on a change in pull request #35733: [SPARK-38188][K8S][TESTS][FOLLOWUP] Cleanup resources in `afterEach`
Yikun commented on a change in pull request #35733:
URL: https://github.com/apache/spark/pull/35733#discussion_r820300284
##########
File path: resource-managers/kubernetes/integration-tests/src/test/scala/org/apache/spark/deploy/k8s/integrationtest/VolcanoTestsSuite.scala
##########
@@ -29,21 +29,63 @@ import scala.concurrent.Future
import io.fabric8.kubernetes.api.model.Pod
import io.fabric8.kubernetes.client.NamespacedKubernetesClient
import io.fabric8.volcano.client.VolcanoClient
+import org.scalatest.BeforeAndAfterEach
import org.scalatest.concurrent.Eventually
import org.apache.spark.SparkFunSuite
import org.apache.spark.deploy.k8s.Config._
import org.apache.spark.deploy.k8s.features.VolcanoFeatureStep
import org.apache.spark.internal.config.NETWORK_AUTH_ENABLED
-private[spark] trait VolcanoTestsSuite { k8sSuite: KubernetesSuite =>
+private[spark] trait VolcanoTestsSuite extends BeforeAndAfterEach { k8sSuite: KubernetesSuite =>
import VolcanoTestsSuite._
import org.apache.spark.deploy.k8s.integrationtest.VolcanoSuite.volcanoTag
import org.apache.spark.deploy.k8s.integrationtest.KubernetesSuite.{k8sTestTag, INTERVAL, TIMEOUT}
lazy val volcanoClient: VolcanoClient
= kubernetesTestComponents.kubernetesClient.adapt(classOf[VolcanoClient])
lazy val k8sClient: NamespacedKubernetesClient = kubernetesTestComponents.kubernetesClient
+ private var testGroups: mutable.Set[String] = mutable.Set.empty
+ private var testYAMLPaths: mutable.Set[String] = mutable.Set.empty
+
+ private def deletePodInTestGroup(): Unit = {
+ testGroups.foreach { g =>
+ k8sClient.pods().withLabel("spark-group-locator", g).delete()
+ Eventually.eventually(TIMEOUT, INTERVAL) {
+ assert(k8sClient.pods().withLabel("spark-group-locator", g).list().getItems.isEmpty)
+ }
+ }
Review comment:
Actually, I make testGroup clear back in the beforeEach, I guess it's already clear for each test?
But I think it's fine for me to move set clear operation into every cleanup api call.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org