Skip to content

[RNDSTROPPY-92]: pick/weighted, ENV(...) api, steps#51

Merged
drrrrr900 merged 4 commits intomainfrom
RNDSTROPPY-92
Mar 6, 2026
Merged

[RNDSTROPPY-92]: pick/weighted, ENV(...) api, steps#51
drrrrr900 merged 4 commits intomainfrom
RNDSTROPPY-92

Conversation

@Cianidos
Copy link
Contributor

@Cianidos Cianidos commented Mar 6, 2026

Description of Changes

ENV() — typed environment variable accessor

Replaces raw __ENV access with ENV(name, default, description). Supports aliases (array of names), typed defaults (string/number), and descriptions. Metadata is captured by probe for the new --envs section.

const WAREHOUSES = ENV(["SCALE_FACTOR", "WAREHOUSES"], 1, "Number of warehouses");
const DRIVER_URL = ENV("DRIVER_URL", "postgres://postgres:postgres@localhost:5432", "Database connection URL");

NewPicker(seed) — weighted random selection

Provides picker.pick(items) for uniform and picker.pickWeighted(items, weights) for weighted selection. Used in new tpcc-pick.ts workload for TPC-C transaction mix (44/43/4/4/4):

const picker = NewPicker(0);
export default function (): void {
  const workload = picker.pickWeighted(
    [new_order, payments, order_status, delivery, stock_level],
    [44,        43,       4,            4,        4]) as () => void;
  workload();
}

--steps / --no-steps — step filtering

Select or exclude steps at run time without editing the script:

stroppy run tpcc --steps create_schema,load_data
stroppy run tpcc --no-steps drop_schema

Step names are validated against probed steps; unknown names produce an error.

Probe section flags

probe now supports --config, --options, --sql, --steps, --envs to show individual sections. Example stroppy probe tpcc --envs:

# Environment Variables:
  STROPPY_STEPS=""  # comma-separated list of steps to run (allowlist), same as --steps
  STROPPY_NO_STEPS=""  # comma-separated list of steps to skip (blocklist), same as --no-steps
  SQL_FILE="" (default: ./tpcc.sql)  # Path to SQL file (automatically set if .sql file provided as argument)
  DURATION="" (default: 1h)  # Test duration
  VUS_SCALE="" (default: 1)  # VU scaling factor
  POOL_SIZE="" (default: 100)  # Connection pool size
  SCALE_FACTOR | WAREHOUSES="" (default: 1)  # Number of warehouses
  DRIVER_URL="" (default: postgres://postgres:postgres@localhost:5432)  # Database connection URL

Other changes

  • All workloads migrated from __ENV to ENV()
  • drop_schema split into its own step in tpcb/tpcc
  • tpcb/tpcds: simplified k6 options, use default export
  • New tpcc-pick.ts workload (picker-based transaction mix)
  • New run-tpcc-pick-test Makefile target

Motivation and Context

Scripts needed a structured way to declare environment variables with defaults and documentation. Weighted random selection was needed for realistic TPC-C transaction mix. Step filtering allows partial re-runs (e.g. skip schema creation during development).

How Has This Been Tested?

make run-tpcc-pick-test, make run-tpcb-test, make run-simple-test

Type of Changes

  • New feature
  • Refactoring

Checklist

  • I have read the CONTRIBUTING.md
  • I have checked build and tests
  • I have updated documentation if needed

@drrrrr900 drrrrr900 merged commit 3908c3a into main Mar 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants