Keep run logs opaque and streamline transfers
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package spool
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"browser.local/run/protocol"
|
||||
@@ -16,6 +19,17 @@ func TestArtifactQueueRetainsPendingAndRemovesAcknowledgedChunk(t *testing.T) {
|
||||
if err := queue.Enqueue(first); err != nil {
|
||||
t.Fatalf("enqueue first: %v", err)
|
||||
}
|
||||
metadata, err := os.ReadFile(queue.chunkPath(first))
|
||||
if err != nil {
|
||||
t.Fatalf("read queued metadata: %v", err)
|
||||
}
|
||||
if strings.Contains(string(metadata), "payload") {
|
||||
t.Fatalf("queued artifact metadata must not JSON encode payload: %s", string(metadata))
|
||||
}
|
||||
storedPayload, err := os.ReadFile(artifactChunkPayloadPath(queue.chunkPath(first)))
|
||||
if err != nil || !bytes.Equal(storedPayload, first.Payload) {
|
||||
t.Fatalf("queued raw payload mismatch payload=%q err=%v", storedPayload, err)
|
||||
}
|
||||
if err := queue.Enqueue(second); err != nil {
|
||||
t.Fatalf("enqueue second: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user