Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Gatling from container

Tags:

docker

gatling

I am using denvazh/gatling container and everything works well except one thing i try to pass list of simulations like this:

Attaching to gatling
gatling_1 | GATLING_HOME is set to /opt/gatling
gatling_1 | Choose a simulation number:
gatling_1 |      [0] AppsPods
gatling_1 |      [1] ServerSimulation
gatling_1 |      [2] computerdatabase.BasicSimulation
gatling_1 |      [3] computerdatabase.advanced.AdvancedSimulationStep01
gatling_1 |      [4] computerdatabase.advanced.AdvancedSimulationStep02
gatling_1 |      [5] computerdatabase.advanced.AdvancedSimulationStep03 

I write such command as:

docker run -it --rm -v /home/core/gatling/conf:/opt/gatling/conf \
-v /home/core/gatling/user-files:/opt/gatling/user-files \
-v /home/core/gatling/results:/opt/gatling/results \
denvazh/gatling -s AdvancedSimulationStep01

but nothing make sense simulation list shows again and i need to choose test from list to start the simulation. So is it possible to run only that test witch i specify starting docker run command???

like image 860
user6329667 Avatar asked Sep 20 '16 14:09

user6329667


Video Answer


2 Answers

You need to give the fully qualified classname i.e

docker run -it --rm -v /home/core/gatling/conf:/opt/gatling/conf \ -v /home/core/gatling/user-files:/opt/gatling/user-files \ -v /home/core/gatling/results:/opt/gatling/results \ denvazh/gatling -s computerdatabase.advanced.AdvancedSimulationStep01

like image 152
niharika_neo Avatar answered Sep 28 '22 01:09

niharika_neo


I run my simulations a little different, perhaps like this within Taurus harness, where bzt-configs is the folder containing scripts, and artifacts is the folder containing test output:

#!/bin/bash
clear
## use en0, not en1, if your on WIFI
OSX_HOST=`ipconfig getifaddr en0`
MACHINE_HOST=$OSX_HOST
CURRENT_DIR=`pwd`
if [[ -z "${GATLING_HOME}" ]]; then
  GATLING_HOME=~/gatling
fi
EXEC_SUB_FOLDER=out-taurus
EXEC_FOLDER="$CURRENT_DIR/${EXEC_SUB_FOLDER}"
[ -d $EXEC_FOLDER ] || mkdir $EXEC_FOLDER
yes | cp -rf performance/my-simulation/scripts/* $EXEC_FOLDER
cd $EXEC_FOLDER
docker run -it --rm -e MY_ENV='dev' --add-host "machine-host:${MACHINE_HOST}" \
 -v ~/.bzt-rc::/bzt-configs/.bzt-rc -v $PWD:/bzt-configs -v $PWD:/tmp/artifacts \
 blazemeter/taurus:latest /tmp/artifacts/performance.yml
cd ..

Where .yml contains your Gatling bzt config:

execution:
- executor: gatling
  scenario: MySimulation
modules:
  console:
    disable: 'true'
  local:
    sequential: 'true'
reporting:
- module: final-stats
scenarios:
  MySimulation:
    script: computerdatabase.advanced.AdvancedSimulationStep01.scala
    simulation: MySimulation
settings:
  check-interval: 1s

Then your gatling script can use the machine-host name in /etc/hosts to call back to the test target.

like image 37
djangofan Avatar answered Sep 28 '22 01:09

djangofan