Skip to content

Commit 26db354

Browse files
committed
test(handler): tie deploy.finalize bytes to prefix
1 parent a2bbdb1 commit 26db354

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

internal/handler/deploy_logaction_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"net/http"
77
"net/http/httptest"
8+
"strconv"
89
"strings"
910
"testing"
1011

@@ -118,5 +119,12 @@ func TestDeployFinalize_LogsSuccessWithActorAndBytes(t *testing.T) {
118119
require.True(t, ok, "deploy.finalize success line emitted")
119120
assert.Equal(t, "alice", m["actor"])
120121
assert.Equal(t, deployID, m["deploy_id"])
121-
assert.NotEqual(t, "0", m["bytes"], "deployBytes carried on the success line")
122+
var want int64
123+
for k, v := range store.objects {
124+
if strings.HasPrefix(k, prefix) {
125+
want += int64(len(v))
126+
}
127+
}
128+
require.NotZero(t, want, "seeded deploy has non-zero bytes")
129+
assert.Equal(t, strconv.FormatInt(want, 10), m["bytes"], "logged bytes equals the R2 prefix size at finalize (files + marker)")
122130
}

0 commit comments

Comments
 (0)