| 237 | } |
| 238 | |
| 239 | func executeScenario(ctx context.Context, sc scenario, cfg benchmarkConfig, targetURL string) (unstable.Result, error) { |
| 240 | client := unstable.New(unstable.Options{}) |
| 241 | switch sc { |
| 242 | case scenarioBootstrap: |
| 243 | result, err := client.Bootstrap(ctx, unstable.BootstrapRequest{ |
| 244 | Source: gitsync.Endpoint{URL: cfg.SourceURL}, |
| 245 | Target: gitsync.Endpoint{URL: targetURL}, |
| 246 | Scope: cfg.Scope, |
| 247 | IncludeTags: cfg.Policy.IncludeTags, |
| 248 | Protocol: cfg.Policy.Protocol, |
| 249 | Options: cfg.Options, |
| 250 | }) |
| 251 | if err != nil { |
| 252 | return unstable.Result{}, fmt.Errorf("bootstrap: %w", err) |
| 253 | } |
| 254 | return result, nil |
| 255 | case scenarioSync: |
| 256 | result, err := client.Sync(ctx, unstable.SyncRequest{ |
| 257 | Source: gitsync.Endpoint{URL: cfg.SourceURL}, |
| 258 | Target: gitsync.Endpoint{URL: targetURL}, |
| 259 | Scope: cfg.Scope, |
| 260 | Policy: cfg.Policy, |
| 261 | Options: cfg.Options, |
| 262 | }) |
| 263 | if err != nil { |
| 264 | return unstable.Result{}, fmt.Errorf("sync: %w", err) |
| 265 | } |
| 266 | return result, nil |
| 267 | default: |
| 268 | return unstable.Result{}, fmt.Errorf("unsupported scenario %q", sc) |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | func summarizeRuns(runs []runSummary) aggregateSummary { |
| 273 | if len(runs) == 0 { |