Skip to content

Commit

Permalink
Move code for FT back to test folder
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciogeneroso committed Jun 24, 2024
1 parent b68b4b6 commit 6babd47
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 0 deletions.
10 changes: 10 additions & 0 deletions service-discovery-ft/src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
spring:
jmx:
enabled: false
application:
name: sd-functional-tests
profiles:
active: local

service:
host: http://localhost:8081
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cucumber.publish.quiet=true
40 changes: 40 additions & 0 deletions service-discovery-ft/src/test/resources/features/actuator.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Feature: Checking Service Discovery actuator endpoints return expected outputs

Background:
Given initial metrics are gathered

Scenario: When application is healthy, return 200 response status code and "UP" response body on health endpoint
Given a private endpoint PRIVATE_HEALTH_CHECK is prepared
When the request is sent
Then the response status code should be 200
And the health response body of the message should have the status "UP"
And health components should contain the status UP:
| discoveryComposite |
| ping |
| refreshScope |
And metrics are gathered again
And the application_responses_total metric for endpoint PRIVATE_HEALTH_CHECK with status response code 200 has incremented by 1

Scenario: When application is running, display metric content
Given a private endpoint PRIVATE_METRICS is prepared
When the request is sent
Then the response status code should be 200
And the body of the message contains "jvm_buffer_count_buffers"
And metrics are gathered again
# one request to get metrics the first time and one request when running the test
And the application_responses_total metric for endpoint PRIVATE_METRICS with status response code 200 has incremented by 2

Scenario: Return correct app information when calling private/info
Given a private endpoint PRIVATE_INFO is prepared
When the request is sent
Then the response status code should be 200
And it should return build information containing the following keys and values:
| artifact | service-discovery-app |
| name | service-discovery |
| group | com.generoso |
And the response body contains:
| git |
| build |
| java |
And metrics are gathered again
And the application_responses_total metric for endpoint PRIVATE_INFO with status response code 200 has incremented by 1
26 changes: 26 additions & 0 deletions service-discovery-ft/src/test/resources/features/services.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Feature: Checking Service Discovery registration works as expected

Background:
Given initial metrics are gathered

Scenario: When application starts, get apps should returns an empty app list
Given an endpoint GET_APPS is prepared
When the request is sent
Then the response status code should be 200
And the app list should be empty
And metrics are gathered again
And the application_responses_total metric for endpoint GET_APPS with status response code 200 has incremented by 1

# it is flaky, spring-eureka takes time to return the new app after register it and the list might be empty
@ignore
Scenario: a new app is registered successfully
Given an endpoint ADD_APP is prepared with path parameter APP_NAME
And a request body is prepared for APP_NAME
When the request is sent
Then the response status code should be 204
And an endpoint GET_APPS is prepared
And the request is sent
Then the response status code should be 200
And the app list contains an app called APP_NAME
And metrics are gathered again
And the application_responses_total metric for endpoint ADD_APP with parameter APP_NAME and status response code 204 has incremented by 1
12 changes: 12 additions & 0 deletions service-discovery-ft/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>

0 comments on commit 6babd47

Please sign in to comment.