Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/Produktkatalog_E2E(failed).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/consumer_pact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/gatling_erg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/gatling_simple_test_java.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/provider_pact.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/workflows/maven.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
with:
name: surefire-reports
path: '**/surefire-reports/**'

quality_gate:
runs-on: ubuntu-latest
needs: build_and_test
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { defineConfig } = require("cypress");
module.exports = defineConfig({
e2e: {
baseUrl: "http://localhost:5173",
video: true,
video: false,
viewportWidth: 1280,
viewportHeight: 800,
supportFile: false
Expand Down
Binary file not shown.
Binary file removed frontend/src/cypress/screenshots/cypress_open.png
Binary file not shown.
Binary file removed frontend/src/cypress/videos/catalog.cy.js.mp4
Binary file not shown.
12 changes: 5 additions & 7 deletions perf-gatling/pom.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.delis</groupId>
<artifactId>devops-example</artifactId>
<version>1.0.0</version>
</parent>
<properties>
<java.version>21</java.version>
</properties>

<groupId>devops-demo</groupId>
<artifactId>perf-gatling</artifactId>
<version>1.0.0</version>
Expand All @@ -25,12 +24,11 @@
</dependencies>
<build>
<plugins>

<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<configuration>
<simulationClass>simulations.LoginSimulation</simulationClass>
<simulationClass>simulations.ProduktkatalogSimulation</simulationClass>
</configuration>
</plugin>
</plugins>
Expand Down
5 changes: 5 additions & 0 deletions perf-gatling/src/test/java/simulations/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package simulations;

public class Config {
public static final String BASE_URL = "http://localhost:8081";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package simulations;

import io.gatling.javaapi.core.ScenarioBuilder;
import io.gatling.javaapi.core.Simulation;
import io.gatling.javaapi.http.HttpProtocolBuilder;

import static io.gatling.javaapi.core.CoreDsl.rampUsers;
import static io.gatling.javaapi.core.CoreDsl.scenario;
import static io.gatling.javaapi.http.HttpDsl.http;
import static io.gatling.javaapi.http.HttpDsl.status;

public class ProduktkatalogSimulation extends Simulation {

HttpProtocolBuilder httpProtocol = http
.baseUrl(Config.BASE_URL + "/product-api")
.contentTypeHeader("application/json");

ScenarioBuilder scn = scenario("Lade Produktkatalog-Test")
.exec(
http("Lade Produktkatalog")
.get("/products")
.check(status().is(200))
);
{
setUp(
scn.injectOpen(
rampUsers(1000).during(60)
)
).protocols(httpProtocol);
}

}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
C:\Users\denni\git\devops\perf-gatling\src\test\java\simulations\LoginSimulation.java
C:\Users\denni\git\devops\perf-gatling\src\test\java\simulations\ProduktkatalogSimulation.java
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<modules>
<module>order-backend</module>
<module>product-backend</module>
<module>perf-gatling</module>
</modules>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public class ProductController {

private final ProductService productService;

@GetMapping("/products/{id}")
public ResponseEntity<Product> get(@PathVariable("id") Integer id) {
return ResponseEntity.of(productService.getProductById(id));//
}

@GetMapping("/products")
public List<Product> getAll() throws InterruptedException {
return productService.getAllProducts();
}

@GetMapping("/products/{id}")
public ResponseEntity<Product> get(@PathVariable("id") Integer id) {
return ResponseEntity.of(productService.getProductById(id));//
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ class PactProviderVerificationTest {
@MockitoBean
ProductService productService;

@State("product not found")
void setUpProductNotFound(Map<String, Object> params) {
Integer id = Integer.valueOf(params.getOrDefault("id", 1).toString());
when(productService.getProductById(id))
.thenReturn(Optional.empty());
}

@BeforeEach
void setup(@NotNull PactVerificationContext ctx) {
ctx.setTarget(new HttpTestTarget("localhost", port));
Expand All @@ -51,13 +58,6 @@ void setupUpProductExists(Map<String, Object> params) {
.thenReturn(Optional.of(new Product(id, "TestProduct", new BigDecimal("19.99"), EUR)));
}

@State("product not found")
void setUpProductNotFound(Map<String, Object> params) {
Integer id = Integer.valueOf(params.getOrDefault("id", 1).toString());
when(productService.getProductById(id))
.thenReturn(Optional.empty());
}

@TestTemplate
@ExtendWith(PactVerificationInvocationContextProvider.class)
void verify(PactVerificationContext ctx) {
Expand Down