diff --git a/.gitignore b/.gitignore index a4eca6aaf2..fd40f999ce 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ pkg/lib/webparcel/parcel_gen.go # OSX .DS_Store + +# custom build of k6 +/k6/k6 diff --git a/Makefile b/Makefile index 9d49e3a394..eef6f314d9 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ vendor: go install github.com/google/wire/cmd/wire go install golang.org/x/vuln/cmd/govulncheck@latest go install golang.org/x/tools/cmd/goimports@latest + go install go.k6.io/xk6/cmd/xk6@latest npm --prefix ./scripts/npm ci npm --prefix ./authui ci npm --prefix ./portal ci @@ -45,6 +46,7 @@ generate: .PHONY: test test: + $(MAKE) -C ./k6 go-test go test ./pkg/... -timeout 1m30s .PHONY: lint diff --git a/k6/Makefile b/k6/Makefile index 8737663635..7ada571185 100644 --- a/k6/Makefile +++ b/k6/Makefile @@ -1,9 +1,7 @@ #export K6_HTTP_DEBUG=true # We cannot use K6_DURATION and K6_VUS because # using them will make k6 to ignore scenarios. -export DURATION=10s -export VUS=10 -export ENDPOINT=http://localhost:3100 +export ENDPOINT=https://loadtest.authgear-loadtest.com export CLIENT_ID=test export REDIRECT_URI=com.example://host export FIXTURE_FIXED_OTP=000000 @@ -13,14 +11,38 @@ export FIXTURE_PHONE_NUMBER_COUNTRY_CALLING_CODE=+852 export FIXTURE_PHONE_NUMBER_LOW=52000000 export FIXTURE_PHONE_NUMBER_HIGH=57999999 +.PHONY: go-test +go-test: + go test . + +.PHONY: k6 +k6: + xk6 build --with github.com/authgear/authgear-server/k6=. + +.PHONY: clean +clean: + rm -rf ./k6 + .PHONY: signup signup: - k6 run --vus $(VUS) --duration $(DURATION) ./signup.js + ./k6 run --config options.json ./signup.js .PHONY: login login: - k6 run --vus $(VUS) --duration $(DURATION) ./login.js + ./k6 run --config options.json ./login.js + +.PHONY: refresh_access_token +refresh_access_token: + ./k6 run --config options.json ./refresh_access_token.js + +.PHONY: get_user_info +get_user_info: + ./k6 run --config options.json ./get_user_info.js + +.PHONY: biometric_login +biometric_login: + ./k6 run --config options.json ./biometric_login.js .PHONY: healthz healthz: - k6 run --vus $(VUS) --duration $(DURATION) ./healthz.js + ./k6 run --config options.json ./healthz.js diff --git a/k6/authflow.js b/k6/authflow.js index a6e8ceb08e..efa26eb2fd 100644 --- a/k6/authflow.js +++ b/k6/authflow.js @@ -41,7 +41,7 @@ export function authflowCreate({ type, name, questionMarkQuery }) { const json = response.json(); const checkResult = checkJSON(json); if (!checkResult) { - fail(`failed to create authflow ${type}:${name}`); + fail(`failed to create authflow ${type}:${name} ${JSON.stringify(json)}`); } return { response, @@ -66,7 +66,7 @@ export function authflowInput({ result, input }) { const json = response.json(); const checkResult = checkJSON(json); if (!checkResult) { - fail(`failed to input: ${state_token}`); + fail(`failed to input: ${state_token} ${JSON.stringify(json)}`); } return { response, @@ -82,12 +82,12 @@ export function redirect(result) { typeof r.action.data.finish_redirect_uri === "string", }); if (!checkResult) { - fail(`unexpected action: ${result.action}`); + fail(`unexpected action: ${result}`); } return http.get(result.action.data.finish_redirect_uri); } -function authflowIdentify({ phone, email, result }) { +function authflowIdentify({ username, phone, email, result }) { const options = result.action.data.options; const first = options[0]; switch (first.identification) { @@ -107,6 +107,14 @@ function authflowIdentify({ phone, email, result }) { login_id: phone, }, }); + case "username": + return authflowInput({ + result, + input: { + identification: "username", + login_id: username, + }, + }); default: throw new Error("unexpected identification: ", first.identification); } @@ -223,7 +231,7 @@ function authflowAuthenticate({ result }) { } } -export function authflowRun({ phone, email, type, name }) { +export function authflowRun({ username, phone, email, type, name }) { const url = makeAuthenticationURL({ endpoint: ENDPOINT, client_id: CLIENT_ID, @@ -243,7 +251,7 @@ export function authflowRun({ phone, email, type, name }) { while (ret.result.action.type !== "finished") { switch (ret.result.action.type) { case "identify": - ret = authflowIdentify({ phone, email, result: ret.result }); + ret = authflowIdentify({ username, phone, email, result: ret.result }); break; case "verify": ret = authflowVerify({ result: ret.result }); @@ -274,4 +282,6 @@ export function authflowRun({ phone, email, type, name }) { if (!checkResult) { fail("failed to exchange code"); } + + return tokenResponse; } diff --git a/k6/authgear.features.yaml.example b/k6/authgear.features.yaml.example new file mode 100644 index 0000000000..68308f2ec8 --- /dev/null +++ b/k6/authgear.features.yaml.example @@ -0,0 +1,2 @@ +rate_limits: + disabled: true diff --git a/k6/authgear.go b/k6/authgear.go new file mode 100644 index 0000000000..aa36ba2b69 --- /dev/null +++ b/k6/authgear.go @@ -0,0 +1,135 @@ +package authgear + +import ( + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "encoding/json" + "encoding/pem" + "strings" + + "github.com/google/uuid" + "github.com/lestrrat-go/jwx/v2/jwa" + "github.com/lestrrat-go/jwx/v2/jwk" + "github.com/lestrrat-go/jwx/v2/jws" + "go.k6.io/k6/js/modules" +) + +func init() { + modules.Register("k6/x/authgear", new(Authgear)) +} + +func toJavaScript(v interface{}) interface{} { + b, err := json.Marshal(v) + if err != nil { + panic(err) + } + var out interface{} + err = json.Unmarshal(b, &out) + if err != nil { + panic(err) + } + return out +} + +func toJSONBytes(v interface{}) []byte { + b, err := json.Marshal(v) + if err != nil { + panic(err) + } + return b +} + +type Authgear struct{} + +func (*Authgear) Uuid() string { + return uuid.Must(uuid.NewRandom()).String() +} + +func (*Authgear) GenerateRSAPrivateKeyInPKCS8PEM(bits int) string { + key, err := rsa.GenerateKey(rand.Reader, bits) + if err != nil { + panic(err) + } + + der, err := x509.MarshalPKCS8PrivateKey(key) + if err != nil { + panic(err) + } + + block := &pem.Block{ + Type: "PRIVATE KEY", + Bytes: der, + } + var buf strings.Builder + err = pem.Encode(&buf, block) + if err != nil { + panic(err) + } + + return buf.String() +} + +func (*Authgear) JwkKeyFromPKCS8PEM(pkcs8Pem string) interface{} { + key, err := jwk.ParseKey([]byte(pkcs8Pem), jwk.WithPEM(true)) + if err != nil { + panic(err) + } + + return toJavaScript(key) +} + +func (*Authgear) JwkPublicKeyFromJWKPrivateKey(jwkValue interface{}) interface{} { + jwkBytes := toJSONBytes(jwkValue) + jwkPrivateKey, err := jwk.ParseKey(jwkBytes) + if err != nil { + panic(err) + } + jwkPublicKey, err := jwkPrivateKey.PublicKey() + if err != nil { + panic(err) + } + + return toJavaScript(jwkPublicKey) +} + +func (*Authgear) SignJWT(alg string, jwkValue interface{}, payload interface{}, headers map[string]interface{}) string { + jwkBytes := toJSONBytes(jwkValue) + jwkPrivateKey, err := jwk.ParseKey(jwkBytes) + if err != nil { + panic(err) + } + + payloadBytes := toJSONBytes(payload) + + hdr := jws.NewHeaders() + for k, v := range headers { + switch k { + case "jwk": + jwkKey, err := jwk.ParseKey(toJSONBytes(v)) + if err != nil { + panic(err) + } + err = hdr.Set(k, jwkKey) + default: + err = hdr.Set(k, v) + } + if err != nil { + panic(err) + } + } + + b, err := jws.Sign( + payloadBytes, + jws.WithKey( + jwa.SignatureAlgorithm(alg), + jwkPrivateKey, + jws.WithProtectedHeaders(hdr), + ), + ) + if err != nil { + panic(err) + } + + return string(b) +} diff --git a/k6/authgear.yaml.example b/k6/authgear.yaml.example new file mode 100644 index 0000000000..cc23a49f2b --- /dev/null +++ b/k6/authgear.yaml.example @@ -0,0 +1,62 @@ +authentication: + identities: + - login_id + primary_authenticators: + - password + secondary_authentication_mode: disabled +authenticator: + oob_otp: + sms: + phone_otp_mode: sms +http: + public_origin: http://localhost:3100 +id: loadtest +identity: + login_id: + keys: + - type: email +localization: + fallback_language: en + supported_languages: + - en +oauth: + clients: + - access_token_lifetime_seconds: 300 + client_id: test + client_name: loadtest + grant_types: + - authorization_code + - refresh_token + issue_jwt_access_token: true + name: loadtest + redirect_uris: + - "com.example://host" + response_types: + - none + - code +test_mode: + oob_otp: + enabled: true + rules: + - fixed_code: "000000" + regex: .+ + sms: + enabled: true + rules: + - regex: .+ + suppressed: true + email: + enabled: true + rules: + - regex: .+ + suppressed: true +ui: + implementation: authflowv2 +verification: + claims: + email: + enabled: true + required: false + phone_number: + enabled: true + required: false diff --git a/k6/authgear_test.go b/k6/authgear_test.go new file mode 100644 index 0000000000..075c7688aa --- /dev/null +++ b/k6/authgear_test.go @@ -0,0 +1,71 @@ +package authgear + +import ( + "encoding/base64" + "encoding/json" + "strings" + "testing" +) + +func TestUUID(t *testing.T) { + var a Authgear + + uuid := a.Uuid() + if len(uuid) != 36 { + t.Errorf("expected uuid to be 36 characters long") + } +} + +func TestKeyGeneration(t *testing.T) { + var a Authgear + + pkcs8pem := a.GenerateRSAPrivateKeyInPKCS8PEM(128) + jwkValue := a.JwkKeyFromPKCS8PEM(pkcs8pem) + jwkValueObj := jwkValue.(map[string]interface{}) + if jwkValueObj["kty"].(string) != "RSA" { + t.Errorf("expected a RSA private key: %v", jwkValue) + } + + pubKey := a.JwkPublicKeyFromJWKPrivateKey(jwkValue) + pubKeyObj := pubKey.(map[string]interface{}) + if pubKeyObj["kty"].(string) != "RSA" { + t.Errorf("expected a RSA public key: %v", pubKeyObj) + } +} + +func TestSignJWT(t *testing.T) { + var a Authgear + + alg := "RS256" + pkcs8pem := a.GenerateRSAPrivateKeyInPKCS8PEM(1024) + jwkValue := a.JwkKeyFromPKCS8PEM(pkcs8pem) + pubKey := a.JwkPublicKeyFromJWKPrivateKey(jwkValue) + payload := map[string]interface{}{ + "hello": "world", + } + headers := map[string]interface{}{ + "jwk": pubKey, + } + jwt := a.SignJWT(alg, jwkValue, payload, headers) + + parts := strings.Split(jwt, ".") + if len(parts) != 3 { + t.Errorf("unexpected JWT token: %v", jwt) + } + + hdrBytes, err := base64.RawURLEncoding.DecodeString(parts[0]) + if err != nil { + t.Errorf("failed to decode JWT headers: %v", err) + } + + var hdr map[string]interface{} + err = json.Unmarshal(hdrBytes, &hdr) + if err != nil { + t.Errorf("failed to parse JWT headers: %v", err) + } + + _, ok := hdr["jwk"] + if !ok { + t.Errorf("expected jwk to be present in header") + } +} diff --git a/k6/biometric.js b/k6/biometric.js new file mode 100644 index 0000000000..f1ff3d25da --- /dev/null +++ b/k6/biometric.js @@ -0,0 +1,120 @@ +import { check, fail } from "k6"; +import http from "k6/http"; +import { URL } from "https://jslib.k6.io/url/1.0.0/index.js"; +import authgear from "k6/x/authgear"; +import { getChallenge } from "./oauth.js"; + +const device_info = { + ios: { + uname: { + machine: "iPhone13,1", + release: "22.0.0", + sysname: "Darwin", + version: + "Darwin Kernel Version 22.0.0: Tue Aug 16 20:52:01 PDT 2022; root:xnu-8792.2.11.0.1~1/RELEASE_ARM64_T8101", + nodename: "iPhone", + }, + NSBundle: { + CFBundleName: "reactNativeExample", + CFBundleVersion: "1", + CFBundleExecutable: "reactNativeExample", + CFBundleIdentifier: "com.authgear.exampleapp.reactnative", + CFBundleDisplayName: "reactNativeExample", + CFBundleShortVersionString: "1.0", + }, + UIDevice: { + name: "iPhone", + model: "iPhone", + systemName: "iOS", + systemVersion: "16.0.2", + userInterfaceIdiom: "phone", + }, + NSProcessInfo: { isiOSAppOnMac: false, isMacCatalystApp: false }, + }, +}; + +export function enableBiometric({ endpoint, client_id, access_token }) { + const kid = authgear.uuid(); + const privateKeyPEM = authgear.generateRSAPrivateKeyInPKCS8PEM(2048); + + const jwk = authgear.jwkKeyFromPKCS8PEM(privateKeyPEM); + jwk["kid"] = kid; + + const challenge = getChallenge({ endpoint, purpose: "biometric_request" }); + + const now = Math.floor(new Date().getTime() / 1000); + + const payload = { + iat: now, + exp: now + 300, + challenge, + action: "setup", + device_info, + }; + + const headers = { + jwk, + typ: "vnd.authgear.biometric-request", + }; + + const jwt = authgear.signJWT("RS256", jwk, payload, headers); + + const url = new URL("/oauth2/token", endpoint); + const form = { + grant_type: "urn:authgear:params:oauth:grant-type:biometric-request", + jwt, + client_id, + }; + const params = { + headers: { + Authorization: `Bearer ${access_token}`, + }, + }; + const response = http.post(url.toString(), form, params); + const checkResult = check(response, { + "biometric request is of status 200": (r) => r.status === 200, + }); + if (!checkResult) { + fail("failed to perform biometric request"); + } + + return jwk; +} + +export function authenticateBiometric({ endpoint, client_id, jwk }) { + const challenge = getChallenge({ endpoint, purpose: "biometric_request" }); + + const now = Math.floor(new Date().getTime() / 1000); + + const payload = { + iat: now, + exp: now + 300, + challenge, + action: "authenticate", + device_info, + }; + + const headers = { + kid: jwk["kid"], + typ: "vnd.authgear.biometric-request", + }; + + const jwt = authgear.signJWT("RS256", jwk, payload, headers); + + const url = new URL("/oauth2/token", endpoint); + const form = { + grant_type: "urn:authgear:params:oauth:grant-type:biometric-request", + jwt, + client_id, + }; + const response = http.post(url.toString(), form); + const checkResult = check(response, { + "biometric request is of status 200": (r) => r.status === 200, + }); + if (!checkResult) { + fail("failed to perform biometric request"); + } + + const tokenResponse = response.json(); + return tokenResponse; +} diff --git a/k6/biometric_login.js b/k6/biometric_login.js new file mode 100644 index 0000000000..c38d7a1bf1 --- /dev/null +++ b/k6/biometric_login.js @@ -0,0 +1,52 @@ +import { check, fail } from "k6"; +import exec from "k6/execution"; +import { + makeNationalPhoneNumberForLogin, + makeLoginIDs, + getIndex, +} from "./fixture.js"; +import { authflowRun } from "./authflow.js"; +import { enableBiometric, authenticateBiometric } from "./biometric.js"; +import { ENDPOINT, CLIENT_ID } from "./env.js"; + +export function setup() { + const data = []; + const vus = exec.test.options.scenarios.default.vus; + for (let i = 1; i <= vus; ++i) { + const nationalPhone = makeNationalPhoneNumberForLogin({ vu: i }); + const { username, email, phone } = makeLoginIDs(nationalPhone); + const tokenResponse = authflowRun({ + username, + phone, + email, + type: "signup", + name: "default", + }); + const jwk = enableBiometric({ + endpoint: ENDPOINT, + client_id: CLIENT_ID, + access_token: tokenResponse.access_token, + }); + data.push(jwk); + } + return data; +} + +export default function (data) { + const index = getIndex(); + const jwk = data[index]; + const tokenResponse = authenticateBiometric({ + endpoint: ENDPOINT, + client_id: CLIENT_ID, + jwk, + }); + const checkResult = check(tokenResponse, { + "refresh_token is present": (r) => + typeof r.refresh_token === "string" && r.refresh_token !== "", + "access_token is present": (r) => + typeof r.access_token === "string" && r.access_token !== "", + }); + if (!checkResult) { + fail("failed to authenticate with biometric"); + } +} diff --git a/k6/cleanup.sql.example b/k6/cleanup.sql.example new file mode 100644 index 0000000000..c4201b10dd --- /dev/null +++ b/k6/cleanup.sql.example @@ -0,0 +1,19 @@ +DELETE FROM _auth_authenticator_oob WHERE app_id = 'loadtest'; +DELETE FROM _auth_authenticator_passkey WHERE app_id = 'loadtest'; +DELETE FROM _auth_authenticator_password WHERE app_id = 'loadtest'; +DELETE FROM _auth_authenticator_totp where app_id = 'loadtest'; +DELETE FROM _auth_authenticator WHERE app_id = 'loadtest'; +DELETE FROM _auth_identity_anonymous WHERE app_id = 'loadtest'; +DELETE FROM _auth_identity_biometric WHERE app_id = 'loadtest'; +DELETE FROM _auth_identity_login_id WHERE app_id = 'loadtest'; +DELETE FROM _auth_identity_oauth WHERE app_id = 'loadtest'; +DELETE FROM _auth_identity_passkey WHERE app_id = 'loadtest'; +DELETE FROM _auth_identity_siwe WHERE app_id = 'loadtest'; +DELETE FROM _auth_identity WHERE app_id = 'loadtest'; +DELETE FROM _auth_oauth_authorization WHERE app_id = 'loadtest'; +DELETE FROM _auth_password_history WHERE app_id = 'loadtest'; +DELETE FROM _auth_recovery_code WHERE app_id = 'loadtest'; +DELETE FROM _auth_user_group WHERE app_id = 'loadtest'; +DELETE FROM _auth_user_role WHERE app_id = 'loadtest'; +DELETE FROM _auth_verified_claim WHERE app_id = 'loadtest'; +DELETE FROM _auth_user WHERE app_id = 'loadtest'; diff --git a/k6/fixture.js b/k6/fixture.js index 6947d15aa4..c7ac74ac28 100644 --- a/k6/fixture.js +++ b/k6/fixture.js @@ -7,10 +7,12 @@ import { FIXTURE_PHONE_NUMBER_HIGH, } from "./env.js"; -export function makePhoneAndEmail(nationalPhone) { - const email = `user${nationalPhone}@${FIXTURE_EMAIL_DOMAIN}`; +export function makeLoginIDs(nationalPhone) { + const username = `user${nationalPhone}`; + const email = `${username}@${FIXTURE_EMAIL_DOMAIN}`; const phone = `${FIXTURE_PHONE_NUMBER_COUNTRY_CALLING_CODE}${nationalPhone}`; return { + username, email, phone, }; diff --git a/k6/get_user_info.js b/k6/get_user_info.js new file mode 100644 index 0000000000..06e0a8bb27 --- /dev/null +++ b/k6/get_user_info.js @@ -0,0 +1,44 @@ +import { check, fail } from "k6"; +import exec from "k6/execution"; +import { + makeNationalPhoneNumberForLogin, + makeLoginIDs, + getIndex, +} from "./fixture.js"; +import { authflowRun } from "./authflow.js"; +import { getUserInfo } from "./oauth.js"; +import { ENDPOINT } from "./env.js"; + +export function setup() { + const data = []; + const vus = exec.test.options.scenarios.default.vus; + for (let i = 1; i <= vus; ++i) { + const nationalPhone = makeNationalPhoneNumberForLogin({ vu: i }); + const { username, email, phone } = makeLoginIDs(nationalPhone); + const tokenResponse = authflowRun({ + username, + phone, + email, + type: "signup", + name: "default", + }); + data.push(tokenResponse); + } + return data; +} + +export default function (data) { + const index = getIndex(); + const tokenResponse = data[index]; + const userInfo = getUserInfo({ + endpoint: ENDPOINT, + access_token: tokenResponse.access_token, + }); + const checkResult = check(userInfo, { + "sub is present in user info": (r) => + typeof r.sub === "string" && r.sub !== "", + }); + if (!checkResult) { + fail("failed to get user info"); + } +} diff --git a/k6/go.mod b/k6/go.mod new file mode 100644 index 0000000000..d4f198468d --- /dev/null +++ b/k6/go.mod @@ -0,0 +1,57 @@ +module github.com/authgear/authgear-server/k6 + +go 1.21.10 + +require ( + github.com/google/uuid v1.6.0 + github.com/lestrrat-go/jwx/v2 v2.0.21 + go.k6.io/k6 v0.51.0 +) + +require ( + github.com/cenkalti/backoff/v4 v4.2.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/dlclark/regexp2 v1.9.0 // indirect + github.com/dop251/goja v0.0.0-20240220182346-e401ed450204 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/lestrrat-go/blackmagic v1.0.2 // indirect + github.com/lestrrat-go/httpcc v1.0.1 // indirect + github.com/lestrrat-go/httprc v1.0.5 // indirect + github.com/lestrrat-go/iter v1.0.2 // indirect + github.com/lestrrat-go/option v1.0.1 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.33.1 // indirect + github.com/segmentio/asm v1.2.0 // indirect + github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/spf13/afero v1.1.2 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/sdk v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect + go.opentelemetry.io/proto/otlp v1.1.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/grpc v1.63.2 // indirect + google.golang.org/protobuf v1.33.0 // indirect + gopkg.in/guregu/null.v3 v3.3.0 // indirect +) diff --git a/k6/go.sum b/k6/go.sum new file mode 100644 index 0000000000..95992cd659 --- /dev/null +++ b/k6/go.sum @@ -0,0 +1,240 @@ +github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY= +github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dlclark/regexp2 v1.9.0 h1:pTK/l/3qYIKaRXuHnEnIf7Y5NxfRPfpb7dis6/gdlVI= +github.com/dlclark/regexp2 v1.9.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20240220182346-e401ed450204 h1:O7I1iuzEA7SG+dK8ocOBSlYAA9jBUmCYl/Qa7ey7JAM= +github.com/dop251/goja v0.0.0-20240220182346-e401ed450204/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= +github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= +github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-sourcemap/sourcemap v2.1.4+incompatible h1:a+iTbH5auLKxaNwQFg0B+TCYl6lbukKPc7b5x0n1s6Q= +github.com/go-sourcemap/sourcemap v2.1.4+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= +github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= +github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= +github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lestrrat-go/blackmagic v1.0.2 h1:Cg2gVSc9h7sz9NOByczrbUvLopQmXrfFx//N+AkAr5k= +github.com/lestrrat-go/blackmagic v1.0.2/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= +github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= +github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= +github.com/lestrrat-go/httprc v1.0.5 h1:bsTfiH8xaKOJPrg1R+E3iE/AWZr/x0Phj9PBTG/OLUk= +github.com/lestrrat-go/httprc v1.0.5/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= +github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= +github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= +github.com/lestrrat-go/jwx/v2 v2.0.21 h1:jAPKupy4uHgrHFEdjVjNkUgoBKtVDgrQPB/h55FHrR0= +github.com/lestrrat-go/jwx/v2 v2.0.21/go.mod h1:09mLW8zto6bWL9GbwnqAli+ArLf+5M33QLQPDggkUWM= +github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa h1:lx8ZnNPwjkXSzOROz0cg69RlErRXs+L3eDkggASWKLo= +github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa/go.mod h1:fhpOYavp5g2K74XDl/ao2y4KvhqVtKlkg1e+0UaQv7I= +github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd h1:AC3N94irbx2kWGA8f/2Ks7EQl2LxKIRQYuT9IJDwgiI= +github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd/go.mod h1:9vRHVuLCjoFfE3GT06X0spdOAO+Zzo4AMjdIwUHBvAk= +github.com/mstoykov/envconfig v1.5.0 h1:E2FgWf73BQt0ddgn7aoITkQHmgwAcHup1s//MsS5/f8= +github.com/mstoykov/envconfig v1.5.0/go.mod h1:vk/d9jpexY2Z9Bb0uB4Ndesss1Sr0Z9ZiGUrg5o9VGk= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= +github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= +github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e h1:zWKUYT07mGmVBH+9UgnHXd/ekCK99C8EbDSAt5qsjXE= +github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.k6.io/k6 v0.51.0 h1:TdMpPNwYuvtmBF1APoKFHuMnNzdIMI/XLaPklSjrIUw= +go.k6.io/k6 v0.51.0/go.mod h1:72d4MKuvKiRnkbPBGOk/gbz1aAcbKycX+GIlU7IOpuA= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 h1:t6wl9SPayj+c7lEIFgm4ooDBZVb01IhLB4InpomhRw8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0/go.mod h1:iSDOcsnSA5INXzZtwaBPrKp/lWu/V14Dd+llD0oI2EA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 h1:Mw5xcxMwlqoJd97vwPxA8isEaIoxsta9/Q51+TTJLGE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0/go.mod h1:CQNu9bj7o7mC6U7+CA/schKEYakYXWr79ucDHTMGhCM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 h1:Xw8U6u2f8DK2XAkGRFV7BBLENgnTGX9i4rQRxJf+/vs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0/go.mod h1:6KW1Fm6R/s6Z3PGXwSJN2K4eT6wQB3vXX6CVnYX9NmM= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/guregu/null.v3 v3.3.0 h1:8j3ggqq+NgKt/O7mbFVUFKUMWN+l1AmT5jQmJ6nPh2c= +gopkg.in/guregu/null.v3 v3.3.0/go.mod h1:E4tX2Qe3h7QdL+uZ3a0vqvYwKQsRSQKM5V4YltdgH9Y= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/k6/k6_parse_default_output.py b/k6/k6_parse_default_output.py new file mode 100755 index 0000000000..9adbf0eb3f --- /dev/null +++ b/k6/k6_parse_default_output.py @@ -0,0 +1,259 @@ +#!/usr/bin/env python3 +import csv +import re +import sys +from dataclasses import dataclass +from typing import List + + +@dataclass +class SummaryLine1: + elapsed_time: str + total_vus: str + complete_iterations: str + interrupted_iterations: str + + +@dataclass +class SummaryLine2: + vus: str + duration: str + + +@dataclass +class Title: + name: str + + +@dataclass +class Percentage: + name: str + percentage: str + numerator: str + denominator: str + + def __init__(self, name: str, parts: List[str]): + self.name = name + self.percentage = parts[1] + self.numerator = parts[3] + self.denominator = parts[5] + + +@dataclass +class VUS: + name: str + val: str + min: str + max: str + + def __init__(self, name: str, parts: List[str]): + self.name = name + self.val = parts[1] + for p in parts: + if p.startswith("min="): + self.min = p[len("min=")] + if p.startswith("max="): + self.max = p[len("max=")] + + +@dataclass +class Metric: + name: str + avg: str + med: str + p90: str + p95: str + + def __init__(self, name: str, parts: List[str]): + self.name = name + for p in parts: + if p.startswith("avg="): + self.avg = p[len("avg="):] + if p.startswith("med="): + self.med = p[len("med="):] + if p.startswith("p(90)="): + self.p90 = p[len("p(90)="):] + if p.startswith("p(95)="): + self.p95 = p[len("p(95)="):] + + +@dataclass +class Rate: + name: str + total: str + rate: str + + def __init__(self, name: str, parts: List[str]): + self.name = name + self.total = parts[1] + self.rate = parts[2] + + +@dataclass +class TestCase: + title: Title + http_req_duration: Metric + http_reqs: Rate + iteration_duration: Metric + iterations: Rate + summary_line_1: SummaryLine1 + summary_line_2: SummaryLine2 + + def __init__(self, title): + self.title = title + + +def parse_byte_rate(name, line): + stripped_line = line.rstrip() + colon = stripped_line.find(":") + data = line[colon+1:] + parts = data.split(" ") + parts = [p for p in parts if p != ""] + + return Rate( + name=name, + parts=["", parts[0] + parts[1], parts[2] + parts[3]], + ) + + +def parse_metric_or_rate(line): + stripped_line = line.rstrip() + parts = stripped_line.split(" ") + parts = [p for p in parts if p != ""] + + if len(parts) < 1: + return None + + name = parts[0] + if name.startswith("checks"): + return Percentage("checks", parts) + if name.startswith("http_req_failed"): + return Percentage("http_req_failed", parts) + if name.startswith("http_req_blocked"): + return Metric("http_req_blocked", parts) + if name.startswith("http_req_connecting"): + return Metric("http_req_connecting", parts) + if name.startswith("http_req_duration"): + return Metric("http_req_duration", parts) + if name.startswith("http_req_receiving"): + return Metric("http_req_receiving", parts) + if name.startswith("http_req_sending"): + return Metric("http_req_sending", parts) + if name.startswith("http_req_tls_handshaking"): + return Metric("http_req_tls_handshaking", parts) + if name.startswith("http_req_waiting"): + return Metric("http_req_waiting", parts) + if name.startswith("iteration_duration"): + return Metric("iteration_duration", parts) + if name.startswith("http_reqs"): + return Rate("http_reqs", parts) + if name.startswith("iterations"): + return Rate("iterations", parts) + if name.startswith("data_received"): + return parse_byte_rate("data_received", line) + if name.startswith("data_sent"): + return parse_byte_rate("data_sent", line) + if name.startswith("{"): + return Metric("http_req_duration_expected_response_true", parts) + if name.startswith("vus."): + return VUS(name="vus", parts=parts) + if name.startswith("vus_max."): + return VUS(name="vus_max", parts=parts) + + +def parse_summary_line_1(line): + regexp = re.compile(r'running \((.*)\), (\d+)/(\d+) VUs, (\d+) complete and (\d+) interrupted iterations') + match = regexp.search(line.rstrip()) + if match is None: + return None + + return SummaryLine1( + elapsed_time=match.group(1), + total_vus=match.group(3), + complete_iterations=match.group(4), + interrupted_iterations=match.group(5), + ) + + +def parse_summary_line_2(line): + regexp = re.compile(r'\[=+\] (\d+) VUs +(\w+)$') + match = regexp.search(line.rstrip()) + if match is None: + return None + + return SummaryLine2( + vus=match.group(1), + duration=match.group(2), + ) + + +def parse_title(line): + stripped_line = line.strip() + if stripped_line != "": + return Title(stripped_line) + + return None + + +def parse_line(line): + metric_or_rate = parse_metric_or_rate(line) + if metric_or_rate is not None: + return metric_or_rate + + summary_line_1 = parse_summary_line_1(line) + if summary_line_1 is not None: + return summary_line_1 + + summary_line_2 = parse_summary_line_2(line) + if summary_line_2 is not None: + return summary_line_2 + + title = parse_title(line) + if title is not None: + return title + + +def handle_file(f): + test_cases = [] + test_case: TestCase | None = None + for line in f: + v = parse_line(line) + if v is not None: + if isinstance(v, Title): + test_case = TestCase(v) + test_cases.append(test_case) + if isinstance(v, Metric): + if v.name == "http_req_duration" and test_case is not None: + test_case.http_req_duration = v + if v.name == "iteration_duration" and test_case is not None: + test_case.iteration_duration = v + if isinstance(v, Rate): + if v.name == "http_reqs" and test_case is not None: + test_case.http_reqs = v + if v.name == "iterations" and test_case is not None: + test_case.iterations = v + if isinstance(v, SummaryLine1) and test_case is not None: + test_case.summary_line_1 = v + if isinstance(v, SummaryLine2) and test_case is not None: + test_case.summary_line_2 = v + + writer = csv.writer(sys.stdout) + writer.writerow(["case", "duration", "http_req_duration_med", "http_req_duration_p90", "iterations_count", "iterations_rate"]) + + for c in test_cases: + writer.writerow([ + c.title.name, + c.summary_line_2.duration, + c.http_req_duration.med, + c.http_req_duration.p90, + c.iterations.total, + c.iterations.rate, + ]) + + +def main(): + handle_file(sys.stdin) + + +if __name__ == "__main__": + main() diff --git a/k6/login.js b/k6/login.js index bf0976d2bd..306a573d77 100644 --- a/k6/login.js +++ b/k6/login.js @@ -1,8 +1,5 @@ import exec from "k6/execution"; -import { - makeNationalPhoneNumberForLogin, - makePhoneAndEmail, -} from "./fixture.js"; +import { makeNationalPhoneNumberForLogin, makeLoginIDs } from "./fixture.js"; import { authflowRun } from "./authflow.js"; export function setup() { @@ -10,8 +7,9 @@ export function setup() { const vus = exec.test.options.scenarios.default.vus; for (let i = 1; i <= vus; ++i) { const nationalPhone = makeNationalPhoneNumberForLogin({ vu: i }); - const { email, phone } = makePhoneAndEmail(nationalPhone); + const { username, email, phone } = makeLoginIDs(nationalPhone); authflowRun({ + username, phone, email, type: "signup", @@ -24,8 +22,9 @@ export default function () { const nationalPhone = makeNationalPhoneNumberForLogin({ vu: exec.vu.idInTest, }); - const { phone, email } = makePhoneAndEmail(nationalPhone); + const { username, phone, email } = makeLoginIDs(nationalPhone); authflowRun({ + username, phone, email, type: "login", diff --git a/k6/oauth.js b/k6/oauth.js index c9faf53e94..5b0e6134bd 100644 --- a/k6/oauth.js +++ b/k6/oauth.js @@ -4,9 +4,11 @@ import { URL } from "https://jslib.k6.io/url/1.0.0/index.js"; const response_type = "code"; const code_challenge_method = "S256"; -const code_verifier = "secret"; -// code_challenge is S256 of "secret". -const code_challenge = "K7gNU3sdo-OL0wNhqoVWhr3g6s1xYv72ol_pe_Unols"; +// code_verifier must be at least 43 characters long. +// See https://github.com/authgear/authgear-server/pull/4126 +const code_verifier = "the-quick-brown-fox-jumps-over-the-lazy-dog"; +// code_challenge is S256 of code_verifier. +const code_challenge = "lSqEXx4ypW-y7Dj_NrquA6XliP_YgrqI9C1nkbNMIUs"; const scope = "openid offline_access https://authgear.com/scopes/full-access"; const x_suppress_idp_session_cookie = "true"; const x_sso_enabled = "false"; @@ -108,3 +110,24 @@ export function getUserInfo({ endpoint, access_token }) { const json = response.json(); return json; } + +export function getChallenge({ endpoint, purpose }) { + const url = new URL("/oauth2/challenge", endpoint); + const payload = JSON.stringify({ + purpose, + }); + const params = { + headers: { + "Content-Type": "application/json", + }, + }; + const response = http.post(url.toString(), payload, params); + const checkResult = check(response, { + "challenge request is of status 200": (r) => r.status === 200, + }); + if (!checkResult) { + fail("failed to get challenge"); + } + + return response.json().result.token; +} diff --git a/k6/options.json b/k6/options.json new file mode 100644 index 0000000000..d826cb81d8 --- /dev/null +++ b/k6/options.json @@ -0,0 +1,5 @@ +{ + "vus": 10, + "duration": "10s", + "setupTimeout": "120s" +} diff --git a/k6/refresh_access_token.js b/k6/refresh_access_token.js new file mode 100644 index 0000000000..5d5cebb190 --- /dev/null +++ b/k6/refresh_access_token.js @@ -0,0 +1,52 @@ +import { check, fail } from "k6"; +import exec from "k6/execution"; +import { + makeNationalPhoneNumberForLogin, + makeLoginIDs, + getIndex, +} from "./fixture.js"; +import { authflowRun } from "./authflow.js"; +import { refreshAccessToken } from "./oauth.js"; +import { ENDPOINT, CLIENT_ID } from "./env.js"; + +export function setup() { + const data = []; + const vus = exec.test.options.scenarios.default.vus; + for (let i = 1; i <= vus; ++i) { + const nationalPhone = makeNationalPhoneNumberForLogin({ vu: i }); + const { username, email, phone } = makeLoginIDs(nationalPhone); + const tokenResponse = authflowRun({ + username, + phone, + email, + type: "signup", + name: "default", + }); + data.push(tokenResponse); + } + return data; +} + +export default function (data) { + const index = getIndex(); + const originalTokenResponse = data[index]; + const newTokenResponse = refreshAccessToken({ + endpoint: ENDPOINT, + client_id: CLIENT_ID, + refresh_token: originalTokenResponse.refresh_token, + }); + const checkResult = check( + { originalTokenResponse, newTokenResponse }, + { + "access token is refreshed": (r) => { + return ( + r.originalTokenResponse.access_token !== + r.newTokenResponse.access_token + ); + }, + }, + ); + if (!checkResult) { + fail("failed to refresh access token"); + } +} diff --git a/k6/signup.js b/k6/signup.js index 3afce5f072..779abaeb74 100644 --- a/k6/signup.js +++ b/k6/signup.js @@ -1,13 +1,11 @@ -import { - makeNationalPhoneNumberForSignup, - makePhoneAndEmail, -} from "./fixture.js"; +import { makeNationalPhoneNumberForSignup, makeLoginIDs } from "./fixture.js"; import { authflowRun } from "./authflow.js"; export default function () { const nationalPhone = makeNationalPhoneNumberForSignup(); - const { phone, email } = makePhoneAndEmail(nationalPhone); + const { username, phone, email } = makeLoginIDs(nationalPhone); authflowRun({ + username, phone, email, type: "signup",