MCPcopy Create free account
hub / github.com/entireio/git-sync / executeScenario

Function executeScenario

cmd/git-sync-bench/main.go:239–270  ·  view source on GitHub ↗
(ctx context.Context, sc scenario, cfg benchmarkConfig, targetURL string)

Source from the content-addressed store, hash-verified

237}
238
239func 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
272func summarizeRuns(runs []runSummary) aggregateSummary {
273 if len(runs) == 0 {

Callers 1

runFunction · 0.85

Calls 3

NewFunction · 0.92
BootstrapMethod · 0.80
SyncMethod · 0.45

Tested by

no test coverage detected