Skip to content

OPSWAT/metadefender-gatling-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MetaDefender Gatling performance test

Useful links:

Requirements

  • Java 11 installed (Java 8 is not supported)

Build

To build the jar, make sure you have Maven:

mvn clean install

The install step will copy src/main/resources/config.ini to target/config.ini.

Configuration

You can modify the settings in this configuration file: target/config.ini

Example configuration for Metadefender Cloud usage:

[general]
BaseUrl=https://api.metadefender.com/v4/file
ConstantUsers=5
InjectDuration=30
MaxDuration=60
ScanWorkflow=multiscan,sanitize
LocalPath=/home/opswatuser/testfiles
PollingIntervals=500
ApiKey=1234567890abcdefghijklmnopqrstuv
ScanRequestsUpperBound=100

Example configuration for local MetaDefender Core usage:

[general]
BaseUrl=http://localhost:8008/file
ConstantUsers=5
InjectDuration=30
LocalPath=/home/opswatuser/testfiles
PollingIntervals=500
ScanRequestsUpperBound=100

BaseURL:

MetaDefender REST URL, e.g.: https://api.metadefender.com/v4/file (Cloud) or http://localhost:8008/file (local). More information about file scanning: File scanning API

UsersPerSec:

The number of users injected every second during the test (i.e. the number of scan requests per second). Each simulated user will submit a randomly selected file for scanning and wait for the scan result.

InjectDuration:

Injects users into the test during this duration. (seconds)

MaxDuration:

The maximum duration of the test. It is a hard limit with a default value InjectDuration × 10. (seconds)

ScanWorkflow [optional]:

MetaDefender scan workflow rule to activate. Multiple values can be separated by "," to combine multiple workflows. For Cloud-based testing, it can be multiscan, sanitize or unarchive. More details about Cloud workflows: File scanning API -> Request -> rule

For testing local MetaDefender Core, you are free to specify any custom workflow that is available on your installation.

LocalPath:

The folder path where the files to be tested are located, e.g.: /home/user1/tester

This path must point to a valid folder that contains at least one file!

PollingIntervals:

Sleep time between polling scan results. (milliseconds)

ApiKey [Cloud usage only]:

OPSWAT MetaDefender Cloud API key. You can find your key at metadefender.opswat.com -> API key information and limits -> API key. (Registration required.)

ScanRequestsUpperBound [optional]:

Gatling will stop submitting new scan requests when this upper bound is reached. If this bound is zero or not given, the script will upload files for scanning as long as the InjectDuration lasts or the running time does not reach the MaxDuration.

**ShowPollingDetails:

If true, Gatling will also show the polling details as separate requests. By default, it is false. (true/false)

**DeveloperMode:

It true, Gatling will print the HTTP responses to the console. By default, it is false. (true/false)

Running a test

The metadefender-gatling-3.0.0-SNAPSHOT.jar and config.ini files are required to run the test. Maven will install these files in the target folder.

Run a test using the helper script:

./start.sh

The script runs the jar file with the following parameters:

java -cp metadefender-gatling-3.0.0-SNAPSHOT.jar io.gatling.app.Gatling -s ScanSimulation

About

Using Gatling framework to test MetaDefender Core performance

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •