TestURLOverrideDoesNotPersist: a CODEHAMR_URL override lives in cfg.URLOverride and ActiveURL reflects it, but Save writes only the stored URL, so re-bootstrapping without the env var restores the original endpoint.
(t *testing.T)
| 719 | // cfg.URLOverride and ActiveURL reflects it, but Save writes only the stored |
| 720 | // URL, so re-bootstrapping without the env var restores the original endpoint. |
| 721 | func TestURLOverrideDoesNotPersist(t *testing.T) { |
| 722 | dir := t.TempDir() |
| 723 | cfg, _, err := Bootstrap(dir) |
| 724 | if err != nil { |
| 725 | t.Fatal(err) |
| 726 | } |
| 727 | originalURL := cfg.ActiveProfile().URL |
| 728 | cfg.URLOverride = "http://override:9999" |
| 729 | if got := cfg.ActiveURL(); got != "http://override:9999" { |
| 730 | t.Fatalf("ActiveURL() ignored override: %q", got) |
| 731 | } |
| 732 | if got := cfg.ActiveProfile().URL; got != originalURL { |
| 733 | t.Fatalf("override leaked into stored profile: %q", got) |
| 734 | } |
| 735 | if err := cfg.Save(); err != nil { |
| 736 | t.Fatal(err) |
| 737 | } |
| 738 | reloaded, _, err := Bootstrap(dir) |
| 739 | if err != nil { |
| 740 | t.Fatal(err) |
| 741 | } |
| 742 | if reloaded.ActiveProfile().URL != originalURL { |
| 743 | t.Fatalf("Save persisted the override: %q", reloaded.ActiveProfile().URL) |
| 744 | } |
| 745 | if reloaded.URLOverride != "" { |
| 746 | t.Fatalf("URLOverride round-tripped through YAML: %q", reloaded.URLOverride) |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | // TestSaveTightensPreexistingLoosePerms covers the upgrade path fresh-bootstrap |
| 751 | // misses: a config.yaml from an older world-readable codehamr (or a hand-edit) |
nothing calls this directly
no test coverage detected