MCPcopy Create free account
hub / github.com/cloudbase/garm / TestValidateAPIServerConfig

Function TestValidateAPIServerConfig

config/config_test.go:176–262  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

174}
175
176func TestValidateAPIServerConfig(t *testing.T) {
177 cfg := getDefaultAPIServerConfig()
178
179 tests := []struct {
180 name string
181 cfg APIServer
182 errString string
183 }{
184 {
185 name: "Config is valid",
186 cfg: cfg,
187 errString: "",
188 },
189 {
190 name: "Bind address is empty",
191 cfg: APIServer{
192 Bind: "",
193 Port: 9998,
194 },
195 errString: "invalid IP address",
196 },
197 {
198 name: "Bind address is invalid",
199 cfg: APIServer{
200 Bind: "not an IP",
201 Port: 9998,
202 },
203 errString: "invalid IP address",
204 },
205 {
206 name: "Bind address is valid IPv6",
207 cfg: APIServer{
208 Bind: "::",
209 Port: 9998,
210 },
211 errString: "",
212 },
213 {
214 name: "Port is not set",
215 cfg: APIServer{
216 Bind: cfg.Bind,
217 Port: 0,
218 },
219 errString: "invalid port nr 0",
220 },
221 {
222 name: "Port is not valid",
223 cfg: APIServer{
224 Bind: cfg.Bind,
225 Port: 65536,
226 },
227 errString: "invalid port nr 65536",
228 },
229 {
230 name: "Invalid TLS config",
231 cfg: APIServer{
232 Bind: cfg.Bind,
233 Port: cfg.Port,

Callers

nothing calls this directly

Calls 4

RunMethod · 0.45
ValidateMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected