Skip to content

Commit

Permalink
Trivially fixing compile errors due to new schema
Browse files Browse the repository at this point in the history
And remove obsolete message.avdl
  • Loading branch information
eikek committed Feb 9, 2024
1 parent a782666 commit be3ea99
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 55 deletions.
31 changes: 0 additions & 31 deletions modules/messages/src/main/avro/messages.avdl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ class SerializeDeserializeTest extends FunSuite {
val data = ProjectCreated(
UUID.randomUUID().toString,
"my-project",
"a description for it",
None,
Instant.now().truncatedTo(ChronoUnit.MILLIS)
"slug",
Seq.empty,
Visibility.PUBLIC,
Some("a description for it"),
"created-by-me",
Instant.now().truncatedTo(ChronoUnit.MILLIS),
Seq.empty
)
val avro = AvroIO(ProjectCreated.SCHEMA$)

Expand All @@ -45,21 +49,4 @@ class SerializeDeserializeTest extends FunSuite {
assertEquals(decoded, List(data))
}

test("serialize and deserialize ProjectUpdated") {
val data1 = ProjectUpdated(
UUID.randomUUID().toString,
"my-project",
"a description for it",
Shapes.CIRCLE,
Right(42),
Instant.now().truncatedTo(ChronoUnit.MILLIS)
)
val data2 = data1.copy(index = Left("fourtytwo"))
val avro = AvroIO(ProjectUpdated.SCHEMA$)

val bytes = avro.write(Seq(data1, data2))
val decoded = avro.read[ProjectUpdated](bytes)

assertEquals(decoded, List(data1, data2))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ private class SearchProvisionerImpl[F[_]: Async](
}

private lazy val toSolrDocuments: Seq[ProjectCreated] => Seq[Project] =
_.map(pc => Project(id = pc.id, name = pc.name, description = pc.description))
_.map(pc =>
Project(id = pc.id, name = pc.name, description = pc.description.getOrElse(""))
)

private def markProcessedOnFailure(
message: Message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import fs2.Stream
import fs2.concurrent.SignallingRef
import io.renku.avro.codec.AvroIO
import io.renku.avro.codec.encoders.all.given
import io.renku.messages.ProjectCreated
import io.renku.messages.{ProjectCreated, Visibility}
import io.renku.queue.client.Encoding
import io.renku.redis.client.RedisClientGenerators
import io.renku.redis.client.RedisClientGenerators.*
Expand Down Expand Up @@ -131,10 +131,20 @@ class SearchProvisionerSpec extends CatsEffectSuite with RedisSpec with SearchSo
name = s"$prefix-${generateString(max = 5).sample.get}"
desc = s"$prefix ${generateString(max = 10).sample.get}"
ownerGen = generateString(max = 5).map(prefix + _)
yield ProjectCreated(uuid.toString, name, desc, Gen.option(ownerGen).sample.get, now)
yield ProjectCreated(
uuid.toString,
name,
"slug",
Seq.empty,
Visibility.PUBLIC,
Some(desc),
ownerGen.sample.get,
now,
Seq.empty
)

private def toSolrDocument(created: ProjectCreated): Project =
Project(created.id, created.name, created.description)
Project(created.id, created.name, created.description.getOrElse(""))

override def munitFixtures: Seq[Fixture[_]] =
List(withRedisClient, withSearchSolrClient)

0 comments on commit be3ea99

Please sign in to comment.