Documentation ¶
Overview ¶
Package replaybackends provides in-memory implementations of backend dependencies for testing. These implementations re-play backend responses recorded during calls to live production services. To update the files containing replay data for cabe unit tests, see the instructions here: go/cabe-skia-assets
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReplayBackends ¶
type ReplayBackends struct { ParsedPerfResults map[string]perfresults.PerfResults ParsedSwarmingTasks []*apipb.TaskRequestMetadataResponse CASResultReader backends.CASResultReader SwarmingTaskReader backends.SwarmingTaskReader // contains filtered or unexported fields }
ReplayBackends implements the backend interfaces required for testing package etl and rpcservice.
func FromZipFile ¶
func FromZipFile(replayZipFile string, benchmarkName string) *ReplayBackends
FromZipFile opens a zip archive of pre-recorded backend responses and populates a ReplayBackends instance with it suitable for testing purposes.
Replay zip files have the following internal directory structure: ./swarming-tasks.json - json serialized array of apipb.TaskRequestMetadataResponse ./cas/<digest hash> - (multiple) the individual swarming task measurement output files
benchmarkName is typically something determined by the thing *executing* the benchmarks, not by the benchmark code itself. Thus, when reconstructing the artifacts for a benchmark run we need to have that name provided a priori since it can't be determined automatically from task output files alone.
func ToZipFile ¶
func ToZipFile(replayZipFile string, rbeClients map[string]*rbeclient.Client, swarmingClient swarmingv2.SwarmingV2Client) *ReplayBackends
ToZipFile is the inverse of FromZipFile. Given a filename to record to, and RBE and Swarming API clients to intercept, this returns a *ReplayBackends instance with SwarmingTaskReader and CasResultReader properties set to functions that will record responses from live services. Be sure to call [ReplayBackends.Close()] when you are done making calls to RBE and Swarming in order to complete the recording process and save the replay data to replayZipFile.
func (*ReplayBackends) Close ¶
func (r *ReplayBackends) Close() error