-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #363 from devatherock/versions-perf-test
test: Added perf test for the /version endpoint
- Loading branch information
Showing
7 changed files
with
117 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/gatling/java/io/github/devatherock/artifactory/controllers/CompositeSimulation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.github.devatherock.artifactory.controllers; | ||
|
||
import static io.gatling.javaapi.core.CoreDsl.exec; | ||
import static io.gatling.javaapi.core.CoreDsl.rampUsers; | ||
import static io.gatling.javaapi.core.CoreDsl.scenario; | ||
|
||
import java.util.Iterator; | ||
import java.util.Map; | ||
|
||
import io.github.devatherock.test.BaseSimulation; | ||
|
||
import io.gatling.javaapi.core.ChainBuilder; | ||
import io.gatling.javaapi.core.ScenarioBuilder; | ||
|
||
public class CompositeSimulation extends BaseSimulation { | ||
|
||
{ | ||
setUp(buildScenario().injectOpen( | ||
rampUsers(Integer.parseInt(getConfig("perf.users"))) | ||
.during(1))) | ||
.protocols(buildProtocol()) | ||
.maxDuration(Long.parseLong(getConfig("perf.duration"))); | ||
} | ||
|
||
protected ScenarioBuilder buildScenario() { | ||
Iterator<Map<String, Object>> feeder = createImageNameFeeder(); | ||
|
||
ChainBuilder suite = exec( | ||
DockerPullsSimulation.buildRequest(), | ||
VersionSimulation.buildRequest()); | ||
|
||
return scenario("All APIs") | ||
.feed(feeder) | ||
.forever() | ||
.on(exec(suite).feed(feeder)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/gatling/java/io/github/devatherock/artifactory/controllers/VersionSimulation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.github.devatherock.artifactory.controllers; | ||
|
||
import static io.gatling.javaapi.core.CoreDsl.exec; | ||
import static io.gatling.javaapi.core.CoreDsl.rampUsers; | ||
import static io.gatling.javaapi.core.CoreDsl.scenario; | ||
import static io.gatling.javaapi.http.HttpDsl.http; | ||
import static io.gatling.javaapi.http.HttpDsl.status; | ||
|
||
import java.util.Iterator; | ||
import java.util.Map; | ||
|
||
import io.github.devatherock.test.BaseSimulation; | ||
|
||
import io.gatling.javaapi.core.ScenarioBuilder; | ||
import io.gatling.javaapi.http.HttpRequestActionBuilder; | ||
|
||
/** | ||
* Perf tests for the {@code /version} endpoint | ||
*/ | ||
public class VersionSimulation extends BaseSimulation { | ||
static final String GET_VERSION = "GET /version"; | ||
|
||
{ | ||
setUp(buildScenario().injectOpen( | ||
rampUsers(Integer.parseInt(getConfig("perf.version.users"))) | ||
.during(1))) | ||
.protocols(buildProtocol()) | ||
.maxDuration(Long.parseLong(getConfig("perf.version.duration"))); | ||
} | ||
|
||
protected ScenarioBuilder buildScenario() { | ||
Iterator<Map<String, Object>> feeder = createImageNameFeeder(); | ||
|
||
return scenario(GET_VERSION) | ||
.feed(feeder) | ||
.forever() | ||
.on(exec(buildRequest()).feed(feeder)); | ||
} | ||
|
||
static HttpRequestActionBuilder buildRequest() { | ||
return http(GET_VERSION) | ||
.get("/version?package=devatherock/#{imageName}") | ||
.check(status().is(200)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
perf.base.url=http://localhost:8080 | ||
perf.docker-pulls.users=10 | ||
perf.docker-pulls.duration=600 | ||
perf.version.users=10 | ||
perf.version.duration=600 | ||
perf.users=10 | ||
perf.duration=600 |