Improve live linux bootstrap smoke · Entire

Improve live linux bootstrap smoke

e4b9f67→main·

Soph·3mo ago·3 files·+28 added/-8 removed

Sessions

d50053e4c868View transcript

[?
Can you take a look at the go code (wasm) in /Users/soph/Work/entire/devenv/entire-io-worktree1 based a bit on that I wonder if something like this can be build:Codex·GPT-5.4·11 steps](/content/gh/entireio/git-sync/session/019d6d29-8cf7-7fe3-adc9-8c3e4d9d5603#timeline-d50053e4c868/index.html)

Changes

3

1
2
3
4
5
6
7
2 unmodified lines

10
11
12
13
14
15
16
387 unmodified lines

404
405
406
407
408
409
410
411
12 unmodified lines

424
425
426
423
424
425
426
427
427
428
429
430
431
432
433
434
435
436
437
4 unmodified lines

442
443
444
445
446
447
448
449
450
451
452
453
29 unmodified lines

483
484
485
486
487
488
489
490
491
492
493
494
495

package syncer

import (
    "bytes"
    "context"
    "net/http"
    "net/http/cgi"
2 unmodified lines

"os/exec"
    "path/filepath"
    "strings"
    "sync"
    "testing"

"github.com/go-git/go-git/v5/plumbing"
387 unmodified lines

type gitHTTPBackendServer struct {
    server *httptest.Server
    root   string
    mu     sync.Mutex
    stderr bytes.Buffer
}

func newGitHTTPBackendServer(t *testing.T, root string) *gitHTTPBackendServer {
12 unmodified lines

"GIT_HTTP_EXPORT_ALL=1",
    },

}

return &gitHTTPBackendServer{
        server: httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
            handler.ServeHTTP(w, r)
        })),
        s := &gitHTTPBackendServer{
            root: root,
        }
    handler.Stderr = &lockedBuffer{server: s}
    s.server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        handler.ServeHTTP(w, r)
    }))
    return s
}

func (s *gitHTTPBackendServer) Close() {
4 unmodified lines

return s.server.URL + "/" + strings.TrimPrefix(name, "/")
}

func (s *gitHTTPBackendServer) Stderr() string {
    s.mu.Lock()
    defer s.mu.Unlock()
    return s.stderr.String()
}

func runGit(t *testing.T, dir string, args ...string) string {
    t.Helper()

29 unmodified lines

t.Fatalf("ref mismatch for %s -> %s: source=%s target=%s", sourceRef, targetRef, sourceHash, targetHash)
    }
}

type lockedBuffer struct {
    server *gitHTTPBackendServer
}

func (b *lockedBuffer) Write(p []byte) (int, error) {
    b.server.mu.Lock()
    defer b.server.mu.Unlock()
    return b.server.stderr.Write(p)
}

Minternal/syncer/git_http_backend_test.go+26/-5

36 unmodified lines

37
38
39
40
40
41
43
42
43
44
45

36 unmodified lines

ProtocolMode:  protocolModeAuto,
        ShowStats:     true,
        MeasureMemory: true,
        MaxPackBytes:  512 * 1024 * 1024,
    })
    if err != nil {
        t.Fatalf("live linux bootstrap failed: %v", err)
        t.Fatalf("live linux bootstrap failed: %v\nbackend-stderr:\n%s", err, server.Stderr())
    }
    if result.Protocol == "" {
        t.Fatalf("expected negotiated protocol, got empty result")
}

Minternal/syncer/live_bootstrap_test.go+1/-2

17 unmodified lines

18
19
20
21
21
22
23
24

17 unmodified lines

[tasks."test:linux-smoke"]
description = "Run optional live linux bootstrap smoke test"
run = "GITSYNC_E2E_LIVE_LINUX=1 go test ./internal/syncer -run TestBootstrap_LiveLinuxSource -v"
run = "GITSYNC_E2E_LIVE_LINUX=1 go test ./internal/syncer -run TestBootstrap_LiveLinuxSource -timeout 60m -v"

[tasks.build]
description = "Build git-sync"