KEYCLOAK-7199 Optional logout step in registration perfromance test
This commit is contained in:
parent
8b5fd2b4ac
commit
fe2ae6ec68
3 changed files with 27 additions and 11 deletions
|
@ -199,6 +199,7 @@ When running the tests it is necessary to define the dataset to be used.
|
|||
| `filterResults` | Whether to filter out requests which are outside of the `measurementPeriod`. | `false` |
|
||||
| `userThinkTime` | Pause between individual scenario steps. | `5` |
|
||||
| `refreshTokenPeriod`| Period after which token should be refreshed. | `10` |
|
||||
| `logoutPct`| Percentage of users who should log out at the end of scenario. | `100` |
|
||||
|
||||
| Test Assertion | Description | Default Value |
|
||||
| --- | --- | --- |
|
||||
|
|
|
@ -70,6 +70,7 @@ public class TestConfig {
|
|||
public static final boolean filterResults = Boolean.getBoolean("filterResults"); // filter out results outside of measurementPeriod
|
||||
public static final int userThinkTime = Integer.getInteger("userThinkTime", 0);
|
||||
public static final int refreshTokenPeriod = Integer.getInteger("refreshTokenPeriod", 0);
|
||||
public static final double logoutPct = Double.valueOf(System.getProperty("logoutPct", "100"));
|
||||
|
||||
// Computed timestamps
|
||||
public static final long simulationStartTime = System.currentTimeMillis();
|
||||
|
@ -139,8 +140,9 @@ public class TestConfig {
|
|||
" measurementPeriod: %s\n"+
|
||||
" filterResults: %s\n"+
|
||||
" userThinkTime: %s\n"+
|
||||
" refreshTokenPeriod: %s",
|
||||
usersPerSec, rampUpPeriod, warmUpPeriod, measurementPeriod, filterResults, userThinkTime, refreshTokenPeriod);
|
||||
" refreshTokenPeriod: %s\n"+
|
||||
" logoutPct: %s",
|
||||
usersPerSec, rampUpPeriod, warmUpPeriod, measurementPeriod, filterResults, userThinkTime, refreshTokenPeriod, logoutPct);
|
||||
}
|
||||
|
||||
public static SimpleDateFormat SIMPLE_TIME = new SimpleDateFormat("HH:mm:ss");
|
||||
|
@ -307,6 +309,9 @@ public class TestConfig {
|
|||
if (sequentialUsersFrom < -1 || sequentialUsersFrom >= usersPerRealm) {
|
||||
throw new RuntimeException("The folowing condition must be met: (-1 <= sequentialUsersFrom < usersPerRealm).");
|
||||
}
|
||||
if (logoutPct < 0 || logoutPct > 100) {
|
||||
throw new RuntimeException("The `logoutPct` needs to be between 0 and 100.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,9 +62,7 @@ object OIDCScenarioBuilder {
|
|||
.refreshTokenSeveralTimes()
|
||||
|
||||
.thinkPause()
|
||||
.logout()
|
||||
|
||||
.thinkPause()
|
||||
.randomLogout()
|
||||
|
||||
val registerAndLogoutScenario = new OIDCScenarioBuilder()
|
||||
.browserOpensLoginPage()
|
||||
|
@ -74,8 +72,7 @@ object OIDCScenarioBuilder {
|
|||
.browserPostsRegistrationDetails()
|
||||
.adapterExchangesCodeForTokens()
|
||||
.thinkPause()
|
||||
.logout()
|
||||
.thinkPause()
|
||||
.randomLogout()
|
||||
|
||||
}
|
||||
|
||||
|
@ -119,7 +116,7 @@ class OIDCScenarioBuilder {
|
|||
def newThinkPause() : ChainBuilder = {
|
||||
pause(TestConfig.userThinkTime, Normal(TestConfig.userThinkTime * 0.2))
|
||||
}
|
||||
|
||||
|
||||
def browserOpensLoginPage() : OIDCScenarioBuilder = {
|
||||
chainBuilder = chainBuilder
|
||||
.exec(http("Browser to Log In Endpoint")
|
||||
|
@ -225,14 +222,27 @@ class OIDCScenarioBuilder {
|
|||
this
|
||||
}
|
||||
|
||||
def logout() : OIDCScenarioBuilder = {
|
||||
chainBuilder = chainBuilder
|
||||
.exec(http("Browser logout")
|
||||
def logoutChain() : ChainBuilder = {
|
||||
exec(http("Browser logout")
|
||||
.get(LOGOUT_ENDPOINT)
|
||||
.headers(UI_HEADERS)
|
||||
.queryParam("redirect_uri", "${appUrl}")
|
||||
.check(status.is(302), header("Location").is("${appUrl}")))
|
||||
}
|
||||
|
||||
def logout() : OIDCScenarioBuilder = {
|
||||
chainBuilder = chainBuilder.exec(logoutChain)
|
||||
this
|
||||
}
|
||||
|
||||
def randomLogout() : OIDCScenarioBuilder = {
|
||||
chainBuilder = chainBuilder
|
||||
.randomSwitch(
|
||||
// logout randomly based on logoutPct param
|
||||
TestConfig.logoutPct -> exec(logoutChain)
|
||||
)
|
||||
this
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue