| 72 | } |
| 73 | |
| 74 | func 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 | |
| 103 | func TestBuildFetchConfigCopiesHaveHashesAtCallSite(t *testing.T) { |
| 104 | req := FetchRequest{ |