(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func 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" |
| 75 | deployment: |
| 76 | stack_name: "test-stack" |
| 77 | mode: "performance" |
| 78 | proxy: |
| 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 | |
| 110 | func TestValidateCLIConfig(t *testing.T) { |
| 111 | // Test valid config |
nothing calls this directly
no test coverage detected