Skip to content

DNAstack/actuator-e2e-test

Repository files navigation

actuator-e2e-test

Java library to test /actuator endpoint.

How to use?

To use this library include actuator-e2e-test as dependency and configure it by environmental variables. For further customization extend class BaseActuatorE2eTest, override methods you need to customize and set environment propertyE2E_BASE_ACTUATOR_TEST_DISABLED to true otherwise tests will be executed from both sub-class and base-class.

Add DNAstack Github repository to pom.xml

<repositories>
    <repository>
        <id>github</id>
        <name>DNAstack Private Github Packages</name>
        <url>https://maven.pkg.github.com/DNAstack/dnastack-packages</url>
    </repository>
    ...
</repositories>

Add dependency to pom.xml

To use this library in your app include following dependency in your pom.xml.

<dependency>
  <groupId>com.dnastack</groupId>
  <artifactId>actuator-e2e-test</artifactId>
  <version>${actuator-e2e-test.version}</version>
</dependency>

Where ${actuator-e2e-test.version} is version of the published library. You can find available versions at github.

Copy maven settings.xml to docker image

Make sure that that maven settings.xml are copied to docker image.

build-docker-e2e-image

# Allows us to pass settings.xml configured on local machine or CI server to access private repo
mkdir -p ${docker_context_dir}/.m2
cp ~/.m2/*.xml ${docker_context_dir}/.m2

Dockerfile

# Allows us to pass settings.xml configured on local machine or CI server to access private repo
ADD target/.m2 /root/.m2

Configuration

Configuration is done by set of environmental variables

Required environmental variables

E2E_BASE_URI - base URI of running application

Optional environmental variables

Check details

E2E_ACTUATOR_INFO_NAME - application name which is should be present in /actuator/info endpoint. Default is notNull validation.

Application has login redirect

E2E_LOGIN_REDIRECT_ENABLED - set to true when unauthenticated requests to /actuator endpoint are redirected to login page.

E2E_LOGIN_URL_PATH - login URL path where unauthenticated requests are redirected. assertRedirect(Response response) method can be overridden to customize response validation after redirect.

Authentication is done by Cookie

E2E_COOKIE_AUTH_ENABLED - set to true to validate that sensitive /actuator endpoints are not exposed when user is logged in using Cookie. Override getCookie() method to provide your Cookie.

Authentication is done by accessToken

E2E_ACCESS_TOKEN_AUTH_ENABLED - set to true to validate that sensitive /actuator endpoints are not exposed when user is logged in using accessToken. Override getAccessToken() method to provide your accessToken. AccessToken is by default retrieved using client_credentials flow for E2E_BASE_URI as resource using these environmental variables:

E2E_WALLET_TOKEN_URI
E2E_WALLET_CLIENT_ID
E2E_WALLET_CLIENT_SECRET

About

Library for testing /actuator endpoint

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages