MCPcopy Create free account
hub / github.com/dan-v/lambda-nat-proxy / TestLoadCLIConfigWithFile

Function TestLoadCLIConfigWithFile

internal/config/config_test.go:67–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func TestLoadCLIConfigWithFile(t *testing.T) {
68 // Create a temporary config file
69 tempDir := t.TempDir()
70 configFile := filepath.Join(tempDir, "test-config.yaml")
71
72 configContent := `aws:
73 region: "us-east-1"
74 profile: "test-profile"
75deployment:
76 stack_name: "test-stack"
77 mode: "performance"
78proxy:
79 port: 9090
80`
81
82 if err := os.WriteFile(configFile, []byte(configContent), 0644); err != nil {
83 t.Fatalf("Failed to create test config file: %v", err)
84 }
85
86 // Load config with specific file
87 cfg, err := LoadCLIConfig(configFile)
88 if err != nil {
89 t.Fatalf("Expected no error loading config file, got %v", err)
90 }
91
92 // Verify custom values were loaded
93 if cfg.AWS.Region != "us-east-1" {
94 t.Errorf("Expected region us-east-1, got %s", cfg.AWS.Region)
95 }
96 if cfg.AWS.Profile != "test-profile" {
97 t.Errorf("Expected profile test-profile, got %s", cfg.AWS.Profile)
98 }
99 if cfg.Deployment.StackName != "test-stack" {
100 t.Errorf("Expected stack name test-stack, got %s", cfg.Deployment.StackName)
101 }
102 if cfg.Deployment.Mode != ModePerformance {
103 t.Errorf("Expected mode performance, got %s", cfg.Deployment.Mode)
104 }
105 if cfg.Proxy.Port != 9090 {
106 t.Errorf("Expected port 9090, got %d", cfg.Proxy.Port)
107 }
108}
109
110func TestValidateCLIConfig(t *testing.T) {
111 // Test valid config

Callers

nothing calls this directly

Calls 1

LoadCLIConfigFunction · 0.85

Tested by

no test coverage detected