Skip to content

Gatling container exit status #81

@cin

Description

@cin

Given that the last command executed after a Gatling simulation has completed is to touch a file, the container will always succeed (even when gatling failed or its assertions failed). Normally this wouldn't matter, but I'm trying to use the Gatling operator as a part of our end-to-end tests. I need to know if any of the requests fail; so when the Gatling assertion fails, it will mark the container as failed. I can then pick that up in our CI tool (GHA in this case) and act accordingly.

https://github.com/st-tech/gatling-operator/blob/main/pkg/commands/commands.go#L75

Maybe do something like this instead?

gatling.sh -sf ${SIMULATIONS_DIR_PATH} -s %s -rsf ${RESOURCES_DIR_PATH} -rf ${RESULTS_DIR_PATH} %s

GATLING_EXIT_STATUS=$?
if [ $GATLING_EXIT_STATUS -ne 0 ]; then
  RUN_STATUS_FILE="${RESULTS_DIR_PATH}/FAILED"
  echo "gatling.sh has failed!" 1>&2
fi
touch ${RUN_STATUS_FILE}
exit $GATLING_EXIT_STATUS

EDIT: you also have to set the JobSpec.BackoffLimit to 0. Otherwise failed pods from jobs will get restarted, and I typically wouldn't want to restart Gatling scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions