fix: harden multi-pod delivery and load verification
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
@@ -33,6 +34,8 @@ func main() {
|
||||
err = mergeCommand(os.Args[2:])
|
||||
case "collect":
|
||||
err = collectCommand(ctx, os.Args[2:])
|
||||
case "verify-db":
|
||||
err = verifyDBCommand(ctx, os.Args[2:])
|
||||
default:
|
||||
usage()
|
||||
os.Exit(2)
|
||||
@@ -42,6 +45,22 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func verifyDBCommand(ctx context.Context, args []string) error {
|
||||
fs := flag.NewFlagSet("verify-db", flag.ContinueOnError)
|
||||
coordinator := fs.String("coordinator", "loadtest/im-pressure/results/coordinator.json", "coordinator ledger path")
|
||||
output := fs.String("output", "-", "verification JSON output path, or - for stdout")
|
||||
tenant := fs.String("tenant", "", "tenant code")
|
||||
dsnEnv := fs.String("dsn-env", "MYSQL_DSN", "environment variable containing the business database DSN")
|
||||
registryDB := fs.String("registry-db", "", "tenant registry database; defaults to TENANT_REGISTRY_DB")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if strings.TrimSpace(*tenant) == "" {
|
||||
return fmt.Errorf("--tenant is required")
|
||||
}
|
||||
return runDBVerify(ctx, *coordinator, *output, *tenant, *dsnEnv, *registryDB)
|
||||
}
|
||||
|
||||
func prepareCommand(ctx context.Context, args []string) error {
|
||||
fs := flag.NewFlagSet("prepare", flag.ContinueOnError)
|
||||
configPath := fs.String("config", "loadtest/im-pressure/config.example.json", "JSON configuration path")
|
||||
@@ -135,12 +154,14 @@ func collectCommand(ctx context.Context, args []string) error {
|
||||
output := fs.String("output", "loadtest/im-pressure/results/metrics.jsonl", "snapshot output")
|
||||
interval := fs.Duration("interval", 5*time.Second, "collection interval")
|
||||
duration := fs.Duration("duration", 10*time.Minute, "collection duration")
|
||||
coordinatorURL := fs.String("coordinator", "", "optional coordinator base URL used to label before/during phases")
|
||||
coordinatorOutput := fs.String("coordinator-output", "", "coordinator JSON path used to detect the after phase")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
return runCollector(ctx, urls, *output, *interval, *duration)
|
||||
return runCollector(ctx, urls, *output, *interval, *duration, *coordinatorURL, *coordinatorOutput)
|
||||
}
|
||||
|
||||
func usage() {
|
||||
fmt.Fprintln(os.Stderr, "usage: im-pressure <prepare|verify|coordinator|agent|merge|collect> [flags]")
|
||||
fmt.Fprintln(os.Stderr, "usage: im-pressure <prepare|verify|coordinator|agent|merge|collect|verify-db> [flags]")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user