Skip to content

Commit

Permalink
delete namespace tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hagay3 committed Jun 30, 2022
1 parent 868d2c8 commit e06d895
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions client/src/it/scala/skuber/DeploymentSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,30 @@ class DeploymentSpec extends K8SFixture with Eventually with Matchers with Befor
val deploymentSpecific42: String = randomUUID().toString
val deploymentSpecific51: String = randomUUID().toString
val deploymentSpecific52: String = randomUUID().toString
val deploymentSpecific61: String = randomUUID().toString
val deploymentSpecific62: String = randomUUID().toString

val namespace1: String = randomUUID().toString
val namespace2: String = randomUUID().toString
val namespace3: String = randomUUID().toString
val namespace4: String = randomUUID().toString
val namespace5: String = randomUUID().toString
val namespace6: String = randomUUID().toString


override implicit val patienceConfig: PatienceConfig = PatienceConfig(10.second)

override def afterAll(): Unit = {
val k8s = k8sInit(config)

val results = Future.sequence(List(deploymentName1, deploymentName2, deploymentName3).map { name =>
val results = Future.sequence(List(deploymentName1, deploymentName2,
deploymentName3, deploymentSpecific41, deploymentSpecific42, deploymentSpecific51, deploymentSpecific52).map { name =>
k8s.delete[Deployment](name).withTimeout().recover { case _ => () }
}).withTimeout()

results.futureValue

results.onComplete { r =>
results.onComplete { _ =>
List(namespace1, namespace2, namespace3, namespace4, namespace5).foreach { name =>
deleteNamespace(name, k8s)
}
k8s.close
system.terminate().recover { case _ => () }.valueT
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/it/scala/skuber/K8SFixture.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ trait K8SFixture extends fixture.FlatSpec {
}

def createNamespace(name: String, k8s: FixtureParam): Namespace = k8s.create[Namespace](Namespace.forName(name)).valueT
def deleteNamespace(name: String, k8s: FixtureParam): Unit = k8s.delete[Namespace](name).valueT
def deleteNamespace(name: String, k8s: FixtureParam): Unit = k8s.delete[Namespace](name).withTimeout().recover { case _ => () }

def getNginxContainer(version: String): Container = Container(name = "nginx", image = "nginx:" + version).exposePort(80)

Expand Down

0 comments on commit e06d895

Please sign in to comment.