Skip to content

Commit d9cee48

Browse files
committed
Try to compile and run scio-test tests on Scala 3
* Since the module depends on scio-avro (not yet being compiled for Scala 3), some test suites that depend on it were moved to a scala-2 only module. * Some individual tests that were failing to compile were commented out for now - most of them test magnolia-based Coder derivation, which is only implemented for case classes for now
1 parent 5552492 commit d9cee48

26 files changed

+181
-163
lines changed

scio-test/src/main/scala/com/spotify/scio/testing/JobTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ import scala.util.control.NonFatal
7171
object JobTest {
7272
case class BeamOptions(opts: List[String])
7373

74-
private case class BuilderState(
74+
private[JobTest] case class BuilderState(
7575
className: String,
7676
cmdlineArgs: Array[String] = Array(),
7777
input: Map[String, JobInputSource[_]] = Map.empty,

scio-test/src/main/scala/com/spotify/scio/testing/SCollectionMatchers.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,15 @@ trait SCollectionMatchers extends EqInstances {
188188

189189
import ScioMatchers.makeFn
190190

191-
sealed trait MatcherBuilder[T] {
192-
_: Matcher[T] =>
191+
sealed trait MatcherBuilder[T] { self: Matcher[T] =>
193192

194193
type From
195194
type To >: From
196195
type AssertBuilder = From => To
197196

198197
def matcher(builder: AssertBuilder): Matcher[T]
199198

200-
def matcher: Matcher[T] = matcher(identity)
199+
def matcher: Matcher[T] = (t: T) => matcher(t)
201200
}
202201

203202
sealed trait IterableMatcher[T, B] extends MatcherBuilder[T] with Matcher[T] {
@@ -278,7 +277,7 @@ trait SCollectionMatchers extends EqInstances {
278277
* SCollection assertion only applied to the specified window, running the checker only on the
279278
* final pane for each key.
280279
*/
281-
def inFinalPane[T: ClassTag, B: ClassTag](
280+
def inFinalPane[T](
282281
window: BoundedWindow
283282
)(matcher: MatcherBuilder[T]): Matcher[T] =
284283
matcher match {
@@ -292,7 +291,7 @@ trait SCollectionMatchers extends EqInstances {
292291
* SCollection assertion only applied to the specified window, running the checker only on the
293292
* late pane for each key.
294293
*/
295-
def inLatePane[T: ClassTag, B: ClassTag](
294+
def inLatePane[T](
296295
window: BoundedWindow
297296
)(matcher: MatcherBuilder[T]): Matcher[T] =
298297
matcher match {
@@ -439,6 +438,7 @@ trait SCollectionMatchers extends EqInstances {
439438
override def matcher(builder: AssertBuilder): Matcher[SCollection[(K, V)]] =
440439
new Matcher[SCollection[(K, V)]] {
441440
override def apply(left: SCollection[(K, V)]): MatchResult = {
441+
import com.spotify.scio.values.SCollection.makePairSCollectionFunctions
442442
val assertion = builder(PAssert.thatMap(serDeCycle(left).toKV.internal))
443443
m(
444444
() => assertion.isEqualTo(value.asJava),

scio-test/src/main/scala/com/spotify/scio/testing/TransformOverride.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ object TransformOverride {
103103
* with a transform mapping elements via `fn`.
104104
*/
105105
def of[T: ClassTag, U](name: String, fn: T => U): PTransformOverride = {
106-
val wrappedFn: T => U = fn.compose { t: T =>
106+
val wrappedFn: T => U = fn.compose { (t: T) =>
107107
typeValidation(
108108
s"Input for override transform $name does not match pipeline transform.",
109109
t.getClass,
@@ -130,7 +130,7 @@ object TransformOverride {
130130
*/
131131
def ofIter[T: ClassTag, U](name: String, fn: T => Iterable[U]): PTransformOverride = {
132132
val wrappedFn: T => JIterable[U] = fn
133-
.compose { t: T =>
133+
.compose { (t: T) =>
134134
typeValidation(
135135
s"Input for override transform $name does not match pipeline transform.",
136136
t.getClass,

scio-test/src/test/scala/com/spotify/scio/avro/AvroUtils.scala renamed to scio-test/src/test/scala-2/com/spotify/scio/avro/AvroUtils.scala

File renamed without changes.

scio-test/src/test/scala/com/spotify/scio/coders/AvroCoderTest.scala renamed to scio-test/src/test/scala-2/com/spotify/scio/coders/AvroCoderTest.scala

File renamed without changes.

scio-test/src/test/scala/com/spotify/scio/coders/KryoAtomicCoderTest.scala renamed to scio-test/src/test/scala-2/com/spotify/scio/coders/KryoAtomicCoderTest.scala

File renamed without changes.

scio-test/src/test/scala/com/spotify/scio/hash/ApproxFilterTest.scala renamed to scio-test/src/test/scala-2/com/spotify/scio/hash/ApproxFilterTest.scala

File renamed without changes.

scio-test/src/test/scala/com/spotify/scio/hash/MutableScalableBloomFilterTest.scala renamed to scio-test/src/test/scala-2/com/spotify/scio/hash/MutableScalableBloomFilterTest.scala

File renamed without changes.

scio-test/src/test/scala/com/spotify/scio/hash/PartitionSettingsTest.scala renamed to scio-test/src/test/scala-2/com/spotify/scio/hash/PartitionSettingsTest.scala

File renamed without changes.

scio-test/src/test/scala/com/spotify/scio/io/FileFormatTest.scala renamed to scio-test/src/test/scala-2/com/spotify/scio/io/FileFormatTest.scala

File renamed without changes.

0 commit comments

Comments
 (0)