Vi 607 implement identity load testing #19787
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Related issue(s)
Testing done
bundle install bundle exec rails db:migrate
config/load_testing.yml
Known testing gaps:
What areas of the site does it impact?
Acceptance criteria
Requested Feedback
Specific areas for review:
Core Module Files
Controllers
modules/load_testing/app/controllers/load_testing/v0/test_sessions_controller.rb
Models
modules/load_testing/app/models/load_testing/test_session.rb
Jobs
modules/load_testing/app/jobs/load_testing/load_test_job.rb
Database Setup
Migrations
modules/load_testing/db/migrate/20241122090000_create_load_testing_tables.rb
modules/load_testing/db/migrate/20241122090001_create_load_testing_client_config.rb
modules/load_testing/db/migrate/20241122090002_add_results_to_test_sessions.rb
Schema
db/schema.rb
Configuration
Engine Setup
modules/load_testing/lib/load_testing/engine.rb
Routes
modules/load_testing/config/routes.rb
Configuration Files
modules/load_testing/config/load_testing.yml
config/settings.yml
Puma Configuration
config/puma.rb
Test Scripts
k6 Scripts
modules/load_testing/scripts/scenarios/full_auth_flow.js
Documentation
Setup Guide
.developer-setup
API Documentation
app/controllers/v0/apidocs_controller.rb
spec/requests/swagger_spec.rb
Integration
Sign In Controller
app/controllers/v0/sign_in_controller.rb
Dependencies
Gemfile.lock
Module Specification
modules/load_testing/load_testing.gemspec
Load Testing Setup Guide
1. Initial Setup
Install Dependencies
Run Migrations
bundle exec rails db:migrate
2. Configure Test Client
Create Client Configuration
Open a Rails console:
bundle exec rails c
Create the test client:
3. Configure Load Testing Settings
Update Configuration File
In
modules/load_testing/config/load_testing.yml
:4. Run Load Tests
Basic Test Run
k6 run modules/load_testing/scripts/scenarios/full_auth_flow.js \ --env SESSION_ID=1 \ --env API_BASE_URL=http://localhost:3000 \ --env LOGIN_EMAIL=your-test-user@example.com \ --env LOGIN_PASSWORD=your-test-password \ --env STAGES='[{"target":1,"duration":"1m"},{"target":1,"duration":"3m"},{"target":0,"duration":"1m"}]' \ --vus 1
Test with Different Scenarios
Ramp-up Test
Constant Load Test
5. Monitor Results
View Test Session Results
Check Rails Logs
Common Issues and Solutions
Rate Limiting
If you encounter rate limiting:
Authentication Failures
If authentication fails:
Database Issues
If you encounter database errors:
Additional Configuration
Puma Settings
In
config/puma.rb
:Environment Variables
Required environment variables:
Load Testing Setup Guide
1. Initial Setup
Install Dependencies
Run Migrations
bundle exec rails db:migrate
2. Configure Test Client
Create Client Configuration
Open a Rails console:
bundle exec rails c
Create the test client:
3. Configure Load Testing Settings
Update Configuration File
In
modules/load_testing/config/load_testing.yml
:4. Run Load Tests
Basic Test Run
k6 run modules/load_testing/scripts/scenarios/full_auth_flow.js \ --env SESSION_ID=1 \ --env API_BASE_URL=http://localhost:3000 \ --env LOGIN_EMAIL=your-test-user@example.com \ --env LOGIN_PASSWORD=your-test-password \ --env STAGES='[{"target":1,"duration":"1m"},{"target":1,"duration":"3m"},{"target":0,"duration":"1m"}]' \ --vus 1
Test with Different Scenarios
Ramp-up Test
Constant Load Test
5. Monitor Results
View Test Session Results
Check Rails Logs
Common Issues and Solutions
Rate Limiting
If you encounter rate limiting:
Authentication Failures
If authentication fails:
Database Issues
If you encounter database errors:
Additional Configuration
Puma Settings
In
config/puma.rb
:Environment Variables
Required environment variables: