(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestLoadConfig_InvalidPort(t *testing.T) { |
| 60 | tests := []struct { |
| 61 | name string |
| 62 | val string |
| 63 | }{ |
| 64 | {"non-numeric", "abc"}, |
| 65 | {"zero", "0"}, |
| 66 | {"negative", "-1"}, |
| 67 | {"too-large", "99999"}, |
| 68 | } |
| 69 | for _, tc := range tests { |
| 70 | t.Run(tc.name, func(t *testing.T) { |
| 71 | os.Setenv("GOSQLX_MCP_PORT", tc.val) |
| 72 | defer os.Unsetenv("GOSQLX_MCP_PORT") |
| 73 | _, err := LoadConfig() |
| 74 | if err == nil { |
| 75 | t.Errorf("expected error for port %q, got nil", tc.val) |
| 76 | } |
| 77 | }) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | func TestLoadConfig_AuthToken(t *testing.T) { |
| 82 | os.Setenv("GOSQLX_MCP_AUTH_TOKEN", "supersecret") |
nothing calls this directly
no test coverage detected