pjfanning commented on code in PR #242: URL: https://github.com/apache/pekko-management/pull/242#discussion_r1771552560
########## discovery-eureka/src/test/scala/org/apache/pekko/discovery/eureka/EurekaServiceDiscoverySpec.scala: ########## @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.pekko.discovery.eureka + +import org.apache.pekko +import pekko.actor.ActorSystem +import pekko.discovery.ServiceDiscovery.ResolvedTarget +import pekko.discovery.eureka.{ EurekaServiceDiscovery, JsonFormat } +import pekko.testkit.TestKitBase +import com.typesafe.config.ConfigFactory +import org.kiwiproject.eureka.EmbeddedEurekaServer +import org.scalatest.BeforeAndAfterAll +import org.scalatest.concurrent.ScalaFutures +import org.scalatest.matchers.should.Matchers +import org.scalatest.time.{ Millis, Seconds, Span } +import org.scalatest.wordspec.AnyWordSpecLike +import spray.json._ + +import java.net.InetAddress +import scala.concurrent.{ ExecutionContext, Future } +import scala.concurrent.duration.DurationInt +import scala.io.Source +import scala.util.Try + +class EurekaServiceDiscoverySpec + extends AnyWordSpecLike + with Matchers + with BeforeAndAfterAll + with TestKitBase + with ScalaFutures { + + private val embeddedEurekaServer = new EmbeddedEurekaServer() + embeddedEurekaServer.start() + private val testConfig = ConfigFactory.parseString( + s""" + |pekko.discovery.eureka { + | eureka-port = ${embeddedEurekaServer.getEurekaPort()} + |} + |""".stripMargin).withFallback(ConfigFactory.load()) + + override implicit lazy val system: ActorSystem = ActorSystem("test", testConfig) + implicit val ec: ExecutionContext = system.dispatcher + + implicit override val patienceConfig: PatienceConfig = + PatienceConfig(timeout = scaled(Span(30, Seconds)), interval = scaled(Span(50, Millis))) + + override def afterAll(): Unit = { + super.afterAll() + embeddedEurekaServer.stop() + } + + "Eureka Discovery" should { + "work for defaults" in { + val lookupService = new EurekaServiceDiscovery() + val resolved = lookupService.lookup("BANK-ACCOUNT", 10.seconds).futureValue + resolved.addresses should contain( Review Comment: With the changes that I have committed, the embeddedEurekaServer is starting and can be contacted. The response for this test though is: ``` [ERROR] [09/23/2024 15:16:35.239] [test-pekko.actor.default-dispatcher-5] [EurekaServiceDiscovery(pekko://test)] Failed to unmarshal Eureka response status [404 Not Found], entity: [{ "servlet":"default", "message":"Not Found", "url":"/eureka/apps/BANK-ACCOUNT", "status":"404" }], uri: [http://127.0.0.1:53003/eureka/apps/BANK-ACCOUNT] ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For additional commands, e-mail: notifications-h...@pekko.apache.org