MCPcopy Create free account
hub / github.com/entireio/git-sync / TestClientRejectsUnknownStrategyBeforeIO

Function TestClientRejectsUnknownStrategyBeforeIO

unstable/client_test.go:74–101  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestClientRejectsUnknownStrategyBeforeIO(t *testing.T) {
75 t.Parallel()
76 // The reviewer's concern: an invalid value should fail at the
77 // API edge, not silently slip through on a non-bootstrap path
78 // (e.g. Probe) where bootstrap planning never runs.
79 c := New(Options{HTTPClient: &http.Client{}})
80 bad := AdvancedOptions{BootstrapStrategy: "unsupported"}
81 if _, err := c.Probe(context.Background(), ProbeRequest{
82 Source: gitsync.Endpoint{URL: "https://source.example/repo.git"},
83 Options: bad,
84 }); err == nil {
85 t.Errorf("Probe with invalid bootstrap strategy should error")
86 }
87 if _, err := c.Sync(context.Background(), SyncRequest{
88 Source: gitsync.Endpoint{URL: "https://source.example/repo.git"},
89 Target: gitsync.Endpoint{URL: "https://target.example/repo.git"},
90 Options: bad,
91 }); err == nil {
92 t.Errorf("Sync with invalid bootstrap strategy should error")
93 }
94 if _, err := c.Bootstrap(context.Background(), BootstrapRequest{
95 Source: gitsync.Endpoint{URL: "https://source.example/repo.git"},
96 Target: gitsync.Endpoint{URL: "https://target.example/repo.git"},
97 Options: bad,
98 }); err == nil {
99 t.Errorf("Bootstrap with invalid bootstrap strategy should error")
100 }
101}
102
103func TestBuildFetchConfigCopiesHaveHashesAtCallSite(t *testing.T) {
104 req := FetchRequest{

Callers

nothing calls this directly

Calls 4

BootstrapMethod · 0.80
NewFunction · 0.70
ProbeMethod · 0.45
SyncMethod · 0.45

Tested by

no test coverage detected