mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
feat(runner): thread step screenshot into PushSnapshot
This commit is contained in:
1 parent
1b3545abb2
commit
bae2ca6e8d
1 file changed
+11
-9
@@ -105,6 +105,7 @@ func Run(ctx context.Context, options Options) (Summary, error) {
|
|||||||
var tree *hierarchy.Tree
|
var tree *hierarchy.Tree
|
||||||
var hierarchyErr error
|
var hierarchyErr error
|
||||||
var transitional bool
|
var transitional bool
|
||||||
|
var screenshotPNG []byte
|
||||||
var metrics *trace.Metrics
|
var metrics *trace.Metrics
|
||||||
var logs []verifier.LogEntry
|
var logs []verifier.LogEntry
|
||||||
|
|
||||||
@@ -118,7 +119,7 @@ func Run(ctx context.Context, options Options) (Summary, error) {
|
|||||||
// screenshot describe the same frame, then re-fetches the pair
|
// screenshot describe the same frame, then re-fetches the pair
|
||||||
// while the tree still looks transitional.
|
// while the tree still looks transitional.
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
tree, transitional, hierarchyErr = fetchSyncedState(gctx, options, logger, si)
|
tree, screenshotPNG, transitional, hierarchyErr = fetchSyncedState(gctx, options, logger, si)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
@@ -183,12 +184,13 @@ func Run(ctx context.Context, options Options) (Summary, error) {
|
|||||||
skippedVerification := false
|
skippedVerification := false
|
||||||
if !transitional {
|
if !transitional {
|
||||||
if err := options.Verifier.PushSnapshot(verifier.SnapshotInput{
|
if err := options.Verifier.PushSnapshot(verifier.SnapshotInput{
|
||||||
Tree: tree,
|
Tree: tree,
|
||||||
LastAction: lastAction,
|
ScreenshotPNG: screenshotPNG,
|
||||||
StepTime: stepStart,
|
LastAction: lastAction,
|
||||||
StepIndex: stepIndex,
|
StepTime: stepStart,
|
||||||
RunStart: summary.StartTime,
|
StepIndex: stepIndex,
|
||||||
Logs: logs,
|
RunStart: summary.StartTime,
|
||||||
|
Logs: logs,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return summary, fmt.Errorf("step %d push: %w", stepIndex, err)
|
return summary, fmt.Errorf("step %d push: %w", stepIndex, err)
|
||||||
}
|
}
|
||||||
@@ -855,7 +857,7 @@ const (
|
|||||||
// on a still-transitional tree. Callers use it to skip the verifier for
|
// on a still-transitional tree. Callers use it to skip the verifier for
|
||||||
// that step so the previous/current extractor advance does not absorb
|
// that step so the previous/current extractor advance does not absorb
|
||||||
// transient state.
|
// transient state.
|
||||||
func fetchSyncedState(ctx context.Context, options Options, logger *slog.Logger, stepIndex int) (tree *hierarchy.Tree, transitional bool, err error) {
|
func fetchSyncedState(ctx context.Context, options Options, logger *slog.Logger, stepIndex int) (tree *hierarchy.Tree, png []byte, transitional bool, err error) {
|
||||||
var pngBytes []byte
|
var pngBytes []byte
|
||||||
var previousJSON string
|
var previousJSON string
|
||||||
retryLoop:
|
retryLoop:
|
||||||
@@ -896,7 +898,7 @@ retryLoop:
|
|||||||
logger.Warn("screenshot write failed", "step", stepIndex, "err", writeErr)
|
logger.Warn("screenshot write failed", "step", stepIndex, "err", writeErr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tree, transitional, err
|
return tree, pngBytes, transitional, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// isTransitionalHierarchy returns true when the tree carries more than one
|
// isTransitionalHierarchy returns true when the tree carries more than one
|
||||||
|
|||||||
Reference in new issue
Block a user