Skip to content

Commit

Permalink
Merge branch 'RM-4730_shares_server' into 'master'
Browse files Browse the repository at this point in the history
RM-4730: Create share-server load tests

See merge request cdoc2/cdoc2-gatling-tests!4
  • Loading branch information
Olesja Aarma committed Feb 26, 2025
2 parents d720e64 + f164b5f commit a664dc8
Show file tree
Hide file tree
Showing 71 changed files with 1,526 additions and 114 deletions.
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/src/test/resources/application.conf
/src/test/resources/keys/test-clients/*.p12
test-results.log
/cdoc2-capsule-server/src/test/resources/application.conf
/cdoc2-capsule-server/src/test/resources/keys/test-clients/*.p12
cdoc2-capsule-server/capsule-server-test-results.log

/cdoc2-shares-server/src/test/resources/application.conf
/cdoc2-shares-server/src/test/resources/keys/test-clients/*.p12
cdoc2-shares-server/shares-server-test-results.log

# ---> Maven
target/
Expand Down
17 changes: 8 additions & 9 deletions README.md → cdoc2-capsule-server/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Gatling tests for CDOC2 server
# Gatling tests for CDOC2 capsule server

## Preconditions for executing tests

Expand All @@ -11,14 +11,14 @@ source src/test/resources/remote_repository.sh
sh src/test/resources/copy_client_keystore.sh
```

* The latest cdoc2 java libraries are installed locally. From cdoc2-server directory run:
* The latest cdoc2 java libraries are installed locally. From cdoc2-capsule-server directory run:

```
mvn clean install
```

* CDOC key servers are is running
* Can be started inside cdoc2-server catalog with commands:
* CDOC key servers are running
* Can be started inside cdoc2-capsule-server catalog with commands:
```
cd get-server
java -Dspring.config.location=config/application-local.properties -jar target/cdoc2-get-server-VER.jar
Expand Down Expand Up @@ -55,7 +55,7 @@ Create a configuration file using the sample file:
cp src/test/resources/application.conf.sample src/test/resources/application.conf
```

## Generate TLS certificates for connecting to cdoc2 server
## Generate TLS certificates for connecting to cdoc2 capsule server

From gatling-tests directory run:
```
Expand All @@ -70,17 +70,16 @@ java $JAVA_OPTS -cp target/gatling-tests-VER.jar ee.cyber.cdoc2.server.datagen.K
```


This will generate 10 key stores (the ouput folder and other parameters are configured in pom.xml)
This will generate 10 key stores (the output folder and other parameters are configured in pom.xml)
with private keys and certificates that can be used later in Gatling tests.
The number of generated key stores is specified by the `amount` system property.


## Running functional tests

The following functional tests exist for testing {SERVER_NAME} server functionality
* create and upload capsule to server (createAndGetCreateEccCapsule)
* Get successfully capsule from server (createAndGetCreateEccCapsule)
* Get capsule with incorrect transactionId (createAndGetRecipientTransactionMismatch)
* upload capsule to server and get successfully capsule from server (sendAndGetEccKeyCapsule, sendAndGetRsaKeyCapsule)
* Get capsule with incorrect transactionId (sendAndGetRecipientMismatch)
* Get capsule with invalid transactionId (getWithInvalidTransactionIds)

A CDOC server must be running on the host:port as configured in the configuration file specified above.
Expand Down
92 changes: 92 additions & 0 deletions cdoc2-capsule-server/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>gatling-tests</artifactId>
<groupId>ee.cyber.cdoc2</groupId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>cdoc2-capsule-server-test</artifactId>
<version>2.0.0-SNAPSHOT</version>
<description>CDOC2 capsule server tests</description>

<build>
<plugins>

<!-- task to generate key store files to use in gatling tests -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<configuration>
<mainClass>ee.cyber.cdoc2.server.datagen.KeyStoreGenerator</mainClass>
<systemProperties>
<systemProperty>
<!-- the folder where the generated files will be written -->
<key>output-dir</key>
<value>${basedir}/src/test/resources/keys/test-clients</value>
</systemProperty>
<systemProperty>
<!-- the password for the generated keystores -->
<key>keystore-password</key>
<value>secret</value>
</systemProperty>
<systemProperty>
<!-- the key alias for the generated entry in the keystore -->
<key>key-alias</key>
<value>client-key</value>
</systemProperty>
<systemProperty>
<!-- location of the root keystore to use to sign certificate in the generated keystore -->
<key>root-keystore</key>
<value>${basedir}/src/test/resources/keys/gatling-ca.p12</value>
</systemProperty>
<systemProperty>
<!-- the root keystore type -->
<key>root-keystore-type</key>
<value>pkcs12</value>
</systemProperty>
<systemProperty>
<!-- the key alias for the entry in the root keystore to use for signing -->
<key>root-key-alias</key>
<value>gatling-ca</value>
</systemProperty>
<systemProperty>
<!-- the root keystore password -->
<key>root-keystore-password</key>
<value>secret</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.5.0</version>

<configuration>
<configLocation>../checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>

<sourceDirectories>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
<sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
</sourceDirectories>

<consoleOutput>true</consoleOutput>

<failsOnError>true</failsOnError>
<failOnViolation>false</failOnViolation>

<linkXRef>false</linkXRef>
</configuration>
</plugin>

</plugins>
</build>

</project>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ source variables.sh
#cp ../get-server/docker/application.properties get-server
mkdir -p get-server/keys
cp ${CDOC2_CAPSULE_SERVER_DIR}/keys/servertruststore.jks ${CDOC2_CAPSULE_SERVER_DIR}/keys/cdoc2server.p12 get-server/keys

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ source variables.sh
#cp ../put-server/docker/application.properties put-server
mkdir -p put-server/keys
cp ${CDOC2_CAPSULE_SERVER_DIR}/keys/servertruststore.jks ${CDOC2_CAPSULE_SERVER_DIR}/keys/cdoc2server.p12 put-server/keys

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@ docker run -d --restart on-failure:3 --name $CONTAINER_NAME --user "$(id -u):$(i
$DOCKER_IMAGE
# --network $NETWORK_NAME \
# -v /var/log/cdoc2:/var/log/cdoc2 \
# -v /opt/cdoc2/cdoc2-server/get-server-conf/logback.xml:/workspace/logback.xml \


# -v /opt/cdoc2/cdoc2-capsule-server/get-server-conf/logback.xml:/workspace/logback.xml \
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,4 @@ docker run -d --restart on-failure:3 --name $CONTAINER_NAME --user "$(id -u):$(i
$DOCKER_IMAGE
# --network $NETWORK_NAME \
# -v /var/log/cdoc2:/var/log/cdoc2 \
# -v /opt/cdoc2/cdoc2-server/get-server-conf/logback.xml:/workspace/logback.xml \


# -v /opt/cdoc2/cdoc2-capsule-server/get-server-conf/logback.xml:/workspace/logback.xml \
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

/**
* Load test configuration
*
*/
@Value
public class LoadTestConfig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CDOC2 Gatling tests configuration
# CDOC2 Gatling tests configuration for capsule server

# create capsule server configuration
put-server {
Expand All @@ -15,7 +15,7 @@ get-server {
# key stores to use in communicating with the server
client-keystores {
# absolute path to the folder containing client keystore files
path = "/home/user/absolute/path/to/cdoc2-gatling-tests/src/test/resources/keys/test-clients"
path = "/home/user/absolute/path/to/cdoc2-gatling-tests/cdoc2-capsule-server/src/test/resources/keys/test-clients"
# keystore password (must be the same for all keystores)
password = "secret"
# alias for the key entry
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
-----BEGIN CERTIFICATE-----
MIICSDCCAc2gAwIBAgIJAOBRPfdGvE8YMAoGCCqGSM49BAMEMGoxCzAJBgNVBAYT
AkVFMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdUYWxsaW5uMRQw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NiAARCAp54x81BBAZnA+fo73zaJpNAxIR5vFyG/EBP
j3NvMkRSSiZABJ/uF85Qk1TmAK5+7I2Cg5g6dT8lb9JBDh9iWW28MnMOIYTDglOf
qsGAIBo7HOaWqCLiLI41bKL5oI6jPzA9MB0GA1UdDgQWBBSOc+QzKfFtmItd8Cph
TRuFZQPf+zALBgNVHQ8EBAMCAoQwDwYDVR0TBAgwBgEB/wIBAzAKBggqhkjOPQQD
BANpADBmAjEA6FuSWYlw9MSy8w4UGNhET7TstFbM/P6gYgb2T+GEqq+kOMavybD8
uQdbupALwg4FAjEA5K67Y51Fc5nMTHZYELoiwy/4SLylHRSzEWwzejv2mYpg+I/H
2yyxduEnF5WvQdfc
-----END CERTIFICATE-----
File renamed without changes.
32 changes: 32 additions & 0 deletions cdoc2-capsule-server/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
</encoder>
<immediateFlush>false</immediateFlush>
</appender>

<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>capsule-server-test-results.log</file>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
</encoder>
<immediateFlush>true</immediateFlush>
</appender>

<!-- uncomment and set to DEBUG to log all failing HTTP requests -->
<!-- uncomment and set to TRACE to log all HTTP requests -->
<logger name="io.gatling.http.engine.response" level="DEBUG" />
<!-- <logger name="io.gatling" level="DEBUG" />-->
<logger name="org.springframework" level="DEBUG"/>

<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />

</root>

</configuration>
File renamed without changes.
Loading

0 comments on commit a664dc8

Please sign in to comment.