MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestLoadConfig_InvalidPort

Function TestLoadConfig_InvalidPort

pkg/mcp/config_test.go:59–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func 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
81func TestLoadConfig_AuthToken(t *testing.T) {
82 os.Setenv("GOSQLX_MCP_AUTH_TOKEN", "supersecret")

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
LoadConfigFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected