Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
eikek committed Apr 10, 2024
1 parent 6c9e726 commit 7577886
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import cats.syntax.all.*
import io.github.arainko.ducktape.*
import io.renku.events.v1.*
import io.renku.search.model.{Id, Name}
import io.renku.search.model.projects.{Slug, Visibility, Description}
import io.renku.search.model.projects.{Description, Slug, Visibility}
import io.renku.search.provision.handler.TypeTransformers.given
import io.renku.search.solr.documents.EntityDocument
import io.renku.search.solr.documents.PartialEntityDocument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ trait TypeTransformers:
case MemberRole.Owner =>
PartialEntityDocument.Project(
id = from.projectId.to[Id],
_version_ = DocVersion.Exists, //TODO this is wrong
_version_ = DocVersion.Exists, // TODO this is wrong
owners = Set(from.userId.to[Id]),
members = Set.empty
)
case MemberRole.Member =>
PartialEntityDocument.Project(
id = from.projectId.to[Id],
_version_ = DocVersion.Exists, //TODO this is wrong
_version_ = DocVersion.Exists, // TODO this is wrong
owners = Set.empty,
members = Set(from.userId.to[Id])
)
Expand All @@ -61,14 +61,14 @@ trait TypeTransformers:
case MemberRole.Owner =>
PartialEntityDocument.Project(
id = from.projectId.to[Id],
_version_ = DocVersion.Exists, //TODO this is wrong
_version_ = DocVersion.Exists, // TODO this is wrong
owners = Set(from.userId.to[Id]),
members = Set.empty
)
case MemberRole.Member =>
PartialEntityDocument.Project(
id = from.projectId.to[Id],
_version_ = DocVersion.Exists, //TODO this is wrong
_version_ = DocVersion.Exists, // TODO this is wrong
owners = Set.empty,
members = Set(from.userId.to[Id])
)
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ final class BackgroundCollector[D](
.awakeEvery[IO](every)
.evalTap(time => state.update(_.updateAt(time)))
.evalMap { time =>
task.flatMap(d => logger.trace(s"Periodic result: $d") >> state.update(_.add(d)))
task.flatMap(d =>
logger.trace(s"Periodic result: $d") >> state.update(_.add(d))
)
}
.compile
.drain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ class ConcurrentUpdateSpec extends ProvisioningSuite with ShowInstances:
messageHeaderGen(UserAdded.SCHEMA$, DataContentType.Binary).generateOne,
UserAdded(id = "u1", Some("john"), None, None)
)
results <- handlers.makeUpsert[UserAdded](queueConfig.userAdded)
.take(2).compile.toList
results <- handlers
.makeUpsert[UserAdded](queueConfig.userAdded)
.take(2)
.compile
.toList

_ = assertEquals(results, List.fill(2)(UpsertResponse.VersionConflict))
yield ()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ object ProjectUpdatedProvisioningSpec:
n.visibility == projectUpdated.visibility.to[Visibility] &&
n.owners == p.owners &&
n.members == p.members
case _ => false
case _ => false

case DbState.PartialProject(p) =>
d match
Expand All @@ -112,7 +112,7 @@ object ProjectUpdatedProvisioningSpec:
n.slug.map(_.value) == projectUpdated.slug.some &&
n.visibility == projectUpdated.visibility.to[Visibility].some

case _ => false
case _ => false

val testCases =
val proj = SolrDocumentGenerators.projectDocumentGen.generateOne
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ import io.renku.solr.client.DocVersion

trait SolrDocument:
def id: Id
def `_version_`: DocVersion
def `_version_` : DocVersion
def setVersion(v: DocVersion): SolrDocument
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ enum UpsertResponse:
case VersionConflict

lazy val isSuccess: Boolean = this match
case Success(_) => true
case Success(_) => true
case VersionConflict => false
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ object SolrClientGenerator:
private val fieldNameString: Gen[String] =
Gen.choose(4, 12).flatMap(n => Gen.listOfN(n, Gen.alphaLowerChar)).map(_.mkString)

val versionGen: Gen[DocVersion] = Gen.chooseNum(2L, Long.MaxValue - 1).map(DocVersion.Exact.apply)
val versionGen: Gen[DocVersion] =
Gen.chooseNum(2L, Long.MaxValue - 1).map(DocVersion.Exact.apply)

val fieldNameTypeStr: Gen[FieldName] =
fieldNameString.map(n => s"${n}_s").map(FieldName.apply)
Expand Down

0 comments on commit 7577886

Please sign in to comment.