-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prism-agent): add JVM metrics endpoint, add health/version endpo…
…int (#390) * feat(prism-agent): add JVM metrics endpoint, add health/version endpoint * feat(prism-agent): add health check e2e test, refactor class names * fix: scalafmt and remove additional character --------- Co-authored-by: Yurii Shynbuiev - IOHK <102033808+yshyn-iohk@users.noreply.github.com>
- Loading branch information
1 parent
c95c65f
commit 6d3e5a0
Showing
10 changed files
with
174 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ package-lock.json | |
**/.docker-volumes/* | ||
target/ | ||
**.env.* | ||
project | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/health/HealthInfo.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package io.iohk.atala.agent.server.health | ||
|
||
case class HealthInfo( | ||
version: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package api_models | ||
data class HealthInfo( | ||
var version: String = "", | ||
) |
36 changes: 36 additions & 0 deletions
36
tests/e2e-tests/src/test/kotlin/features/system/SystemSteps.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package features.system | ||
|
||
import api_models.HealthInfo | ||
import common.Utils.lastResponseObject | ||
import io.cucumber.java.en.Then | ||
import io.cucumber.java.en.When | ||
import net.serenitybdd.screenplay.Actor | ||
import net.serenitybdd.screenplay.rest.interactions.Get | ||
import net.serenitybdd.screenplay.rest.questions.ResponseConsequence | ||
import org.apache.http.HttpStatus.SC_OK | ||
import org.assertj.core.api.Assertions.assertThat | ||
|
||
class SystemSteps { | ||
@When("{actor} makes a request to the health endpoint") | ||
fun actorRequestsHealthEndpoint(actor: Actor) { | ||
actor.attemptsTo( | ||
Get.resource("/_system/health"), | ||
) | ||
actor.should( | ||
ResponseConsequence.seeThatResponse { | ||
it.statusCode(SC_OK) | ||
}, | ||
) | ||
val healthResponse = lastResponseObject("", HealthInfo::class) | ||
assertThat(healthResponse) | ||
.hasFieldOrProperty("version") | ||
.hasNoNullFieldsOrProperties() | ||
actor.remember("version", healthResponse.version) | ||
} | ||
|
||
@Then("{actor} knows what version of the service is running") | ||
fun actorUnderstandsVersion(actor: Actor) { | ||
assertThat(actor.recall<String>("version")) | ||
.isNotBlank() | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
tests/e2e-tests/src/test/resources/features/system/health_endpoint.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@system @smoke | ||
Feature: Agent Health Endpoint | ||
|
||
Scenario: The runtime version can be retrieved from the Health Endpoint | ||
When Acme makes a request to the health endpoint | ||
Then Acme knows what version of the service is running |