Replace linux fetch smoke with bootstrap smoke · Entire

Replace linux fetch smoke with bootstrap smoke

e368b12→main·

Soph·3mo ago·3 files·+66 added/-38 removed

Sessions

9425efd8edfcView 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·2 steps](/content/gh/entireio/git-sync/session/019d6d29-8cf7-7fe3-adc9-8c3e4d9d5603#timeline-9425efd8edfc/index.html)

Changes

3

255 unmodified lines

256
257
258
259
259
260
261
262
262
263
264
265
265
266
267
268

255 unmodified lines

That path exercises real smart HTTP fetch and push with a local bare source repo and a local bare target repo.

There is also an optional live read-only smoke against the public Linux repository:
There is also an optional live Linux bootstrap smoke against the public Linux repository:

```bash
env GOCACHE=/tmp/go-build GITSYNC_E2E_LIVE_LINUX=1 go test ./internal/syncer -run TestFetch_LiveLinuxSource -v
env GOCACHE=/tmp/go-build GITSYNC_E2E_LIVE_LINUX=1 go test ./internal/syncer -run TestBootstrap_LiveLinuxSource -v

That is useful for large-source protocol and memory measurement checks without requiring a writable remote. That is useful for large-source relay and memory measurement checks while keeping the target local and disposable.

Planned Bootstrap Path


MREADME.md+3/-3

```
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

package syncer

import (
    "context"
    "os"
    "os/exec"
    "path/filepath"
    "testing"

"github.com/go-git/go-git/v5/plumbing"
)

const liveLinuxEnv = "GITSYNC_E2E_LIVE_LINUX"

func TestBootstrap_LiveLinuxSource(t *testing.T) {
    if os.Getenv(liveLinuxEnv) == "" {
        t.Skip("set GITSYNC_E2E_LIVE_LINUX=1 to run the live linux bootstrap smoke test")
    }

if _, err := exec.LookPath("git"); err != nil {
        t.Skipf("git not available: %v", err)
    }

root := t.TempDir()
    targetBare := filepath.Join(root, "target.git")

runGit(t, root, "init", "--bare", targetBare)
    runGit(t, targetBare, "config", "http.receivepack", "true")

server := newGitHTTPBackendServer(t, root)
    defer server.Close()

result, err := Bootstrap(context.Background(), Config{
        Source:        Endpoint{URL: "https://github.com/torvalds/linux.git"},
        Target:        Endpoint{URL: server.RepoURL("target.git")},
        Branches:      []string{"master"},
        ProtocolMode:  protocolModeAuto,
        ShowStats:     true,
        MeasureMemory: true,
        MaxPackBytes:  512 * 1024 * 1024,
    })
    if err != nil {
        t.Fatalf("live linux bootstrap failed: %v", err)
    }
    if result.Protocol == "" {
        t.Fatalf("expected negotiated protocol, got empty result")
    }
    if result.Pushed != 1 {
        t.Fatalf("expected one pushed ref, got %+v", result)
    }
    if !result.Relay || result.RelayMode != "bootstrap" {
        t.Fatalf("expected bootstrap relay result, got %+v", result)
    }
    if !result.Measurement.Enabled {
        t.Fatalf("expected measurement to be enabled")
    }
    if _, err := exec.LookPath("git"); err == nil {
        targetHash := runGit(t, targetBare, "rev-parse", plumbing.NewBranchReferenceName("master").String())
        if targetHash == "" {
            t.Fatalf("expected target master ref to exist")
        }
    }
}
```

Ainternal/syncer/live\_bootstrap\_test.go+63

```

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

package syncer

import (
    "context"
    "os"
    "testing"
)

const liveLinuxEnv = "GITSYNC_E2E_LIVE_LINUX"

func TestFetch_LiveLinuxSource(t *testing.T) {
    if os.Getenv(liveLinuxEnv) == "" {
        t.Skip("set GITSYNC_E2E_LIVE_LINUX=1 to run the live linux source smoke test")
    }

result, err := Fetch(context.Background(), Config{
        Source: Endpoint{URL: "https://github.com/torvalds/linux.git"},
        Branches: []string{"master"},
        ProtocolMode: protocolModeAuto,
        ShowStats: true,
        MeasureMemory: true,
    }, nil, nil)
    if err != nil {
        t.Fatalf("live linux fetch failed: %v", err)
    }
    if result.Protocol == "" {
        t.Fatalf("expected negotiated protocol, got empty result")
    }
    if len(result.Wants) == 0 {
        t.Fatalf("expected at least one wanted ref")
    }
    if !result.Measurement.Enabled {
        t.Fatalf("expected measurement to be enabled")
    }
}
```

Dinternal/syncer/live\_source\_test.go-35