Skip to content

Commit

Permalink
Tests use scala-k8s-scalacheck generators
Browse files Browse the repository at this point in the history
  • Loading branch information
hnaderi committed Sep 16, 2022
1 parent aeeb91c commit 63cc734
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ lazy val cookbook = project
pluginCrossBuild / sbtVersion := "1.2.8", // set minimum sbt version
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % munitVersion % Test,
"org.scalameta" %% "munit-scalacheck" % munitVersion % Test
"org.scalameta" %% "munit-scalacheck" % munitVersion % Test,
"dev.hnaderi" %% "scala-k8s-scalacheck" % scalaK8sVersion % Test
)
)
.dependsOn(manifest)
Expand Down
31 changes: 1 addition & 30 deletions cookbook/src/test/scala/MicroserviceDefinitionSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@
package dev.hnaderi.sbtk8s

import dev.hnaderi.k8s._
import dev.hnaderi.k8s.scalacheck.Generators._
import io.k8s.api.apps.v1.Deployment
import io.k8s.api.core.v1.Probe
import io.k8s.api.core.v1.ResourceRequirements
import io.k8s.api.core.v1.Service
import io.k8s.api.networking.v1.Ingress
import io.k8s.apimachinery.pkg.api.resource.Quantity
import io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector
import io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
import io.k8s.apimachinery.pkg.util.intstr.IntOrString
import munit.Location
import munit.ScalaCheckSuite
import org.scalacheck.Arbitrary
Expand Down Expand Up @@ -143,32 +140,6 @@ object MicroserviceDefinitionSuite {
private implicit val arbData: Arbitrary[Data] = Arbitrary(
Gen.alphaStr.map(Data(_))
)
private implicit val intOrString: Arbitrary[IntOrString] = Arbitrary(
Gen.oneOf(
Gen.numStr.map(IntOrString(_)),
Gen.posNum[Int].map(IntOrString(_))
)
)
private implicit val grpcAction = Arbitrary(
Gen.resultOf(io.k8s.api.core.v1.GRPCAction)
)
private implicit val tcpSocketAction = Arbitrary(
Gen.resultOf(io.k8s.api.core.v1.TCPSocketAction)
)
private implicit val httpHeader = Arbitrary(
Gen.resultOf(io.k8s.api.core.v1.HTTPHeader)
)
private implicit val httpGetAction = Arbitrary(
Gen.resultOf(io.k8s.api.core.v1.HTTPGetAction)
)
private implicit val execAction = Arbitrary(
Gen.resultOf(io.k8s.api.core.v1.ExecAction)
)
private implicit val probes = Arbitrary(Gen.resultOf(Probe))
private implicit val quantity = Arbitrary(Gen.resultOf(Quantity))
private implicit val resourceRequirements = Arbitrary(
Gen.resultOf(ResourceRequirements)
)

private implicit val dummyEnvironment: Arbitrary[Seq[Environment]] =
Arbitrary(Gen.const(Nil))
Expand Down

0 comments on commit 63cc734

Please sign in to comment.