Skip to content

Commit

Permalink
refactor: fixed broken test and missed parts of code to update
Browse files Browse the repository at this point in the history
  • Loading branch information
KristianLentinoCT committed Nov 8, 2024
1 parent ec6b71c commit c786c70
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PubSubClientSuite extends QueueClientSuite {
private def config: IO[(String, CredentialsProvider, Option[String], PubSubConfig)] =
booleanOrDefault(isEmulatorEnvVar, default = isEmulatorDefault).ifM(
ifTrue =
IO.pure(("test-project", NoCredentialsProvider.create(), Some("localhost:8042"), PubSubConfig("test-suite"))),
IO.pure(("test-project", NoCredentialsProvider.create(), Some("localhost:8042"), PubSubConfig("test-suite-"))),
ifFalse = for {
project <- string("GCP_PUBSUB_PROJECT")
credentials = GoogleCredentialsProvider
Expand All @@ -52,7 +52,7 @@ class PubSubClientSuite extends QueueClientSuite {
"https://www.googleapis.com/auth/monitoring.read" // monitoring (for fetching stats)
).asJava)
.build()
} yield (project, credentials, None, PubSubConfig("test-suite"))
} yield (project, credentials, None, PubSubConfig("test-suite-"))
)

override def client: Resource[IO, QueueClient[IO]] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private class PubSubAdministration[F[_]](
Subscription
.newBuilder()
.setTopic(topicName.toString())
.setName(SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}-$name").toString())
.setName(SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}$name").toString())
.setAckDeadlineSeconds(lockTTL.toSeconds.toInt)
.setMessageRetentionDuration(ttl)
// An empty expiration policy (no TTL set) ensures the subscription is never deleted
Expand All @@ -85,7 +85,7 @@ private class PubSubAdministration[F[_]](
.adaptError(makeQueueException(_, name))

override def update(name: String, messageTTL: Option[FiniteDuration], lockTTL: Option[FiniteDuration]): F[Unit] = {
val subscriptionName = SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}-$name")
val subscriptionName = SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}$name")
val updateSubscriptionRequest = (messageTTL, lockTTL) match {
case (Some(messageTTL), Some(lockTTL)) =>
val mttl = Duration.newBuilder().setSeconds(messageTTL.toSeconds).build()
Expand Down Expand Up @@ -151,7 +151,7 @@ private class PubSubAdministration[F[_]](
override def configuration(name: String): F[QueueConfiguration] =
subscriptionClient.use { client =>
wrapFuture[F, Subscription](F.delay {
val subscriptionName = SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}-$name")
val subscriptionName = SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}$name")
client
.getSubscriptionCallable()
.futureCall(GetSubscriptionRequest.newBuilder().setSubscription(subscriptionName.toString()).build())
Expand Down Expand Up @@ -179,7 +179,7 @@ private class PubSubAdministration[F[_]](
.futureCall(
DeleteSubscriptionRequest
.newBuilder()
.setSubscription(SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}-$name").toString())
.setSubscription(SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}$name").toString())
.build())
})
}.void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private class PubSubClient[F[_]: Async] private (
override def statistics(name: String): QueueStatistics[F] =
new PubSubStatistics(
name,
SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}-$name"),
SubscriptionName.of(project, s"${configs.subscriptionNamePrefix}$name"),
monitoringChannelProvider,
credentials,
endpoint)
Expand Down

0 comments on commit c786c70

Please sign in to comment.