Git Product home page Git Product logo

gatling-stepfunction-extension's Introduction

Gatling AWS Step Function Extension

This is a custom Gatling extension that allows you to perform load testing on AWS Step Functions using the AWS SDK. With this extension, you can start a Step Function execution and wait for it to complete, allowing you to test the performance of your Step Functions under load.

Prerequisites

To use this extension, you'll need the following:

  • Java 8 or later
  • Gatling 3.0
  • AWS SDK

Installation

To use this extension, you can add it as a dependency to your Gatling project. Add the following dependency to your Gatling project's build.gradle:

implementation 'dev.joss:gatling-stepfunction-extension:1.4.0'

For other build tools see the maven central repository overview.

Usage

To use this extension in your Gatling simulation, you can import the dev.joss.gatling.sfn.Predef._ package and use the Sfn DSL to create a new simulation. Here's an example:

import dev.joss.gatling.sfn.Predef._
import dev.joss.gatling.sfn.protocol.SfnProtocol
import io.gatling.core.Predef._
import io.gatling.core.scenario.Simulation

import software.amazon.awssdk.services.sfn.SfnClient

import scala.concurrent.duration.DurationInt
import scala.language.postfixOps

class ExampleSimulation extends Simulation {
  var sfnClient: SfnClient = SfnClient.builder().build()
  var sfnArn =
    "arn:aws:states:eu-west-1:000000000000:stateMachine:some-arn"

  val scn = scenario("SFN DSL test")
    .exec(
      sfn("Start Hello World Execution").startExecution
        .arn(sfnArn)
        .payload("{}")
    )
    .pause(5000.milliseconds)
    .exec(sfn("Check the response").checkSucceeded)

  val requests = scn.inject {
    constantUsersPerSec(100) during (5 minutes)
  }
  setUp(requests).protocols(SfnProtocol(sfnClient))

}

This example creates a new Gatling scenario that starts an execution, waits 5 seconds and then checks the step function has succeeded. For a more applied example, see the example project which tests AWS's Hello World step function using localstack.

License

This extension is licensed under the MIT License. See the LICENSE file for details.

gatling-stepfunction-extension's People

Contributors

dependabot[bot] avatar illiliilillliiliillillllillillli avatar jossmoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gatling-stepfunction-extension's Issues

Outdated use of protocol usage in README

Search before asking

  • I had searched in the issues and found no similar issues.

Description

The example in the README doesn't reflect the best way to use the DSL. There is the correct usage in the example project using:

var sfnProtocol = sfn.client(sfnClient)

Solution

Update the example in the README to be similar to the example project.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Better logging for `checkStateSucceeded ` when no task can be found

Search before asking

  • I had searched in the issues and found no similar issues.

Version

v1.3.1

What's Wrong?

Currently when you use checkStateSucceeded for an event that doesn't exist, it just supplies the reason

Reason: head of empty list

What You Expected?

You would expect a reason like:

Reason: Succeeded event with name {name} and type {type} could not be found.

How to Reproduce?

.exec(
  sfn(
    "Make a request to check a state has succeeded that does not exist"
  ).checkStateSucceeded
    .stateName("ThisTaskDoesNotExist")
    .stateType(ANY_TYPE)
)

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Execution Arn DSL input should be Arn

Search before asking

  • I had searched in the issues and found no similar issues.

Version

v1.1.0

What's Wrong?

In the API you need to pass the statemachine arn but the request needs a statemachine arn. For example in the README:

val scn = scenario("SFN DSL test")
    .exec(
      sfn("Start Hello World Execution").startExecution
        .executionArn(sfnArn)
        .payload("{}")
    )
    .pause(5000.milliseconds)
    .exec(sfn("Check the response").checkSucceeded)

What You Expected?

val scn = scenario("SFN DSL test")
    .exec(
      sfn("Start Hello World Execution").startExecution
        .arn(sfnArn)
        .payload("{}")
    )
    .pause(5000.milliseconds)
    .exec(sfn("Check the response").checkSucceeded)

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Add ability to check response time within a specific tasks stage instead of the whole step function

Search before asking

  • I had searched in the issues and found no similar issues.

Description

There probably exists a business case where you want to measure a specific task within a step function execution. Im thinking where you might have some heavy processing tasks that then have a load of clean up after, really the end user might only care about performance up until that point. I think we should support this.

Solution

Add a new case class called CheckTaskSucceededAction that works in a similar way to the CheckSucceededAction but instead grabs the response time from the completion of a specific task.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Add spotless as a PR check

Search before asking

  • I had searched in the issues and found no similar issues.

Description

Similar to the test workflow it would be great if we could add the spotless task as an workflow too.

Solution

Create spotless stage to the test workflow would probably be the easiest. Should literally be

- name: Spotless Check
  run: ./gradlew spotlessCheck

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Invalid input mapping parameter name

Search before asking

  • I had searched in the issues and found no similar issues.

Version

v1.1.0

What's Wrong?

This is the map for the input but it uses arn as the mapping parameter

What You Expected?

Would expect the below:

attr.input(session).map { input =>
      request.input(input)
}

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

👷Remove testing from publish action

Search before asking

  • I had searched in the issues and found no similar issues.

Description

To publish we will need to release from main anyway and in which case we will have already run the tests.

Solution

Remove the testing stage.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Adding Integration Tests

Search before asking

  • I had searched in the issues and found no similar issues.

Description

Would be great some have some local integration tests to check the features locally.

Solution

Similar to this .

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Change CheckSucceededAction name

Search before asking

  • I had searched in the issues and found no similar issues.

Version

v1.2.0

What's Wrong?

Description for the action is:

override def name: String = "Describe Step Function Execution"

This isn't a great description when rendering reports and a better description would be better.

What You Expected?

override def name: String = "Step Function Execution Completion"

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Add PR template

Search before asking

  • I had searched in the issues and found no similar issues.

Description

Will help guide contributions.

Solution

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Move pause functionality into CheckActions

Search before asking

  • I had searched in the issues and found no similar issues.

Description

Currently you have to set a pause time explicitly between executions in this library. E.g.

exec(sfn("Start execution of a stepfunction")...)
.pause(x seconds)
.exec(sfn("Some action to check the response")...)

It might be cleaner (and less error prone) to make this pause action a part of both the check actions.

Solution

exec(sfn("Start execution of a stepfunction")...)
.exec(sfn("Some action to check the response")
      .after(x seconds)

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.