Skip to content

Commit bcd2201

Browse files
author
Evan Wang
committed
Added the unit test
Fixes #2475
1 parent 705c479 commit bcd2201

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

internal/site/connector_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,45 @@ func TestUpdateBridgeConfigForConnector(t *testing.T) {
9595
})
9696
}
9797
}
98+
99+
func TestGetSslProfileName(t *testing.T) {
100+
tests := []struct {
101+
name string
102+
tlsCredentials string
103+
useClientCert bool
104+
expected string
105+
}{
106+
{
107+
name: "no tls credentials",
108+
tlsCredentials: "",
109+
useClientCert: false,
110+
expected: "",
111+
},
112+
{
113+
name: "no tls credentials with client cert",
114+
tlsCredentials: "",
115+
useClientCert: true,
116+
expected: "",
117+
},
118+
{
119+
name: "with tls credentials without client cert",
120+
tlsCredentials: "tls-secret",
121+
useClientCert: false,
122+
expected: "tls-secret-profile",
123+
},
124+
{
125+
name: "with tls credentials with client cert",
126+
tlsCredentials: "tls-secret",
127+
useClientCert: true,
128+
expected: "tls-secret",
129+
},
130+
}
131+
for _, tt := range tests {
132+
t.Run(tt.name, func(t *testing.T) {
133+
result := GetSslProfileName(tt.tlsCredentials, tt.useClientCert)
134+
if result != tt.expected {
135+
t.Errorf("got %q, want %q", result, tt.expected)
136+
}
137+
})
138+
}
139+
}

0 commit comments

Comments
 (0)