(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestBuildSyncConfigCarriesAdvancedOptions(t *testing.T) { |
| 14 | cfg, err := New(Options{ |
| 15 | HTTPClient: &http.Client{}, |
| 16 | Auth: gitsync.StaticAuthProvider{ |
| 17 | Source: gitsync.EndpointAuth{Token: "src"}, |
| 18 | Target: gitsync.EndpointAuth{Token: "dst"}, |
| 19 | }, |
| 20 | }).buildSyncConfig(context.Background(), SyncRequest{ |
| 21 | Source: gitsync.Endpoint{URL: "https://source.example/repo.git", FollowInfoRefsRedirect: true}, |
| 22 | Target: gitsync.Endpoint{URL: "https://target.example/repo.git", FollowInfoRefsRedirect: true}, |
| 23 | Scope: gitsync.RefScope{Branches: []string{"main"}}, |
| 24 | Policy: gitsync.SyncPolicy{IncludeTags: true, ForceWithLease: true, Prune: true}, |
| 25 | DryRun: true, |
| 26 | Options: AdvancedOptions{ |
| 27 | CollectStats: true, |
| 28 | MeasureMemory: true, |
| 29 | Verbose: true, |
| 30 | MaterializedMaxObjects: 123, |
| 31 | }, |
| 32 | }) |
| 33 | if err != nil { |
| 34 | t.Fatalf("buildSyncConfig: %v", err) |
| 35 | } |
| 36 | if !cfg.DryRun || !cfg.ShowStats || !cfg.MeasureMemory || !cfg.Verbose { |
| 37 | t.Fatalf("advanced booleans not propagated: %+v", cfg) |
| 38 | } |
| 39 | if cfg.MaterializedMaxObjects != 123 { |
| 40 | t.Fatalf("materialized max objects = %d, want 123", cfg.MaterializedMaxObjects) |
| 41 | } |
| 42 | if cfg.Source.Token != "src" || cfg.Target.Token != "dst" { |
| 43 | t.Fatalf("auth not propagated: %+v %+v", cfg.Source, cfg.Target) |
| 44 | } |
| 45 | if !cfg.Source.FollowInfoRefsRedirect || !cfg.Target.FollowInfoRefsRedirect { |
| 46 | t.Fatalf("follow-info-refs redirect flags not propagated: %+v %+v", cfg.Source, cfg.Target) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | func TestAdvancedOptionsValidate(t *testing.T) { |
| 51 | t.Parallel() |
nothing calls this directly
no test coverage detected