Skip to content

vttranlina/james-gatling

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gatling tests for James server

Build Status

For now, you need to have a running dockerized James JMAP server running on the same computer than your Gatling host. It needs to export the webAdmin over port 8000.

Alternatively you can set up the following system properties:

  • TARGET_HOSTNAME which is set to localhost by default

  • SMTP_PORT which is set to 25 by default

  • SMTP_SSL_PORT which is set to 465 by default

  • JMAP_PORT which is set to 1080 by default

  • JMAP_PROTOCOL which is set to http by default (you can use https instead for example)

  • WEBADMIN_PORT which is set to 8000 by default

  • WEBADMIN_PROTOCOL which is set to http by default (you can use https instead for example)

In some cases you could want to specify target hostname per protocol, the following properties can help you: * SMTP_TARGET_HOSTNAME which is set to TARGET_HOSTNAME by default * JMAP_TARGET_HOSTNAME which is set to TARGET_HOSTNAME by default * IMAP_SERVER_HOSTNAME which is set to TARGET_HOSTNAME by default * WEBADMIN_SERVER_HOSTNAME which is set to TARGET_HOSTNAME by default

You can run all the simulations via sbt :

bash
$ sbt
 > gatling:test

Run a specific simulation via sbt :

bash
$ sbt
 > gatling:testOnly SIMULATION_FQDN

Available simulations

JMAP draft

JmapAuthenticationSimulation

FQDN :

scala
org.apache.james.gatling.simulation.jmap.draft.JmapAuthenticationSimulation

Authenticate 10 JMAP users, one time. Demonstrate user auto-provisioning through James WebAdmin server.

JmapSendMessagesSimulation

FQDN :

scala
org.apache.james.gatling.simulation.jmap.draft.JmapSendMessagesSimulation

Authenticate 100 JMAP users, one time. Then they all retrieve their mailboxes, and then sends messages 360 messages each to other recipients.

JmapGetMailboxesSimulation

FQDN :

scala
org.apache.james.gatling.simulation.jmap.draft.JmapGetMailboxesSimulation

Authenticate 200 JMAP users, one time. Then they all retrieve 360 times their mailboxes each.

JmapGetMessageListSimulation

FQDN :

scala
org.apache.james.gatling.simulation.jmap.draft.JmapGetMessageListSimulation

Authenticate 100 JMAP users, one time. Then they all retrieve their system mailboxes. Then they send each other 10 mails each at random. Then wait 30 seconds for mails to be delivered. Finally they retrieve 250 times each their mails list using GetMessagesList.

JmapGetMessagesSimulation

FQDN :

scala
org.apache.james.gatling.simulation.jmap.draft.JmapGetMessagesSimulation

Authenticate 100 JMAP users, one time. Then they all retrieve their system mailboxes. Then they send each other 10 mails each at random. Then wait 30 seconds for mails to be delivered. They retrieve their mails list using GetMessagesList. Then they retrieve their mails 250 times, at random.

JmapMessageUpdateSimulation

FQDN :

scala
org.apache.james.gatling.simulation.jmap.draft.JmapMessageUpdateSimulation

Authenticate 100 JMAP users, one time. Then they all retrieve their system mailboxes. Then they send each other 10 mails each at random. Then wait 30 seconds for mails to be delivered. They retrieve their mails list using GetMessagesList. Then they update their mail 250 times with the following properties :.

  • 70% mark mails as READ

  • 20% mark mails as ANSWERED

  • 10% mark mails as FLAGGED

JMAP RFC-8621

MailboxGetSimulation

FQDN :

scala
org.apache.james.gatling.simulation.jmap.rfc8621.MailboxGetSimulation

Authenticate 200 JMAP users, one time. Then they all retrieve 360 times their mailboxes each.

SMTP

SmtpNoAuthenticationNoEncryptionMixedBodySimulation

FQDN :

scala
org.apache.james.gatling.simulation.smtp.SmtpNoAuthenticationNoEncryptionMixedBodySimulation

Create 100 users, one time. Then they all send mails to their self, every seconds, using SMTP, without encryption and without authentication.

Building with a local jenkins runner

You can use a custom local jenkins runner with the Jenkinsfile at the root of this project to build the project. This will automatically do for you:

  • checkout and compile the latest code of James Gatling project

  • launch Gatling integration tests

To launch it you need to have docker installed. From the root of this project, you can build the Jenkins runner locally yourself:

docker build -t local-jenkins-runner dockerfiles/jenkins-runner

And then you need to launch it with the Jenkinsfile:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}/dockerfiles/jenkins-runner/Jenkinsfile:/workspace/Jenkinsfile --network=host local-jenkins-runner

If you don’t want the build to redownload everytime all the sbt dependencies (it can be heavy) you can mount your local sbt repository as a volume by adding -v $HOME/.ivy2/cache:/root/.ivy2/cache to the above command.

Docker runner

You can use the Dockerfile at the root to build an image that will contain this Gatling project that you can run.

docker build -t james-gatling-runner dockerfiles/docker-runner

To change configuration variables, you should modify the environment file. You can find an example in sample.env. You should also change the file 'dockerfiles/docker-runner/users.csv` to be able to match your test users on your environment.

To launch it:

docker run --env-file sample.env \
    --mount type=bind,source="$(pwd)"/dockerfiles/docker-runner/users.csv,target=/home/sbtuser/james-gatling/src/test/resources/users.csv \
    -it --rm james-gatling-runner

Then you will be prompted with sbt from inside the container. You can run simulations now.

In case want to run a specific simulation directly, you can use the following command:

docker run --env-file sample.env \
    --mount type=bind,source="$(pwd)"/dockerfiles/docker-runner/users.csv,target=/home/sbtuser/james-gatling/src/test/resources/users.csv \
    -it --rm james-gatling-runner org.apache.james.gatling.simulation.imap.PlatformValidationSimulation

Generate reports for truncated simulations

Sometimes we could have hang simulation when few users can not finish their session. It forces us to break the simulation without any report that generated by Gatling.

We however can save wasted time for the hang simulations by generating reports using the [Gatling report](https://github.com/nuxeo/gatling-report).

For example, we can export the report as CSV format:

java -jar path/to/gatling-report-VERSION-capsule-fat.jar path/to/simulation.log > report.csv

About

Gatling tests for James email server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 99.3%
  • Other 0.7%