cleanup unused certificates
This commit is contained in:
parent
1dc4d184a0
commit
e392c8a8af
4 changed files with 96 additions and 56 deletions
|
|
@ -205,7 +205,7 @@ func TestConfigureDynamically(t *testing.T) {
|
|||
}
|
||||
case "/configuration/servers":
|
||||
{
|
||||
if !strings.Contains(body, `{"certificates":{},"servers":{}}`) {
|
||||
if !strings.Contains(body, `{"certificates":{},"servers":{"myapp.fake":"-1"}}`) {
|
||||
t.Errorf("controllerPodsCount should be present in JSON content: %v", body)
|
||||
}
|
||||
}
|
||||
|
|
@ -330,13 +330,18 @@ func TestConfigureCertificates(t *testing.T) {
|
|||
}
|
||||
defer streamListener.Close()
|
||||
|
||||
servers := []*ingress.Server{{
|
||||
Hostname: "myapp.fake",
|
||||
SSLCert: &ingress.SSLCert{
|
||||
PemCertKey: "fake-cert",
|
||||
UID: "c89a5111-b2e9-4af8-be19-c2a4a924c256",
|
||||
servers := []*ingress.Server{
|
||||
{
|
||||
Hostname: "myapp.fake",
|
||||
SSLCert: &ingress.SSLCert{
|
||||
PemCertKey: "fake-cert",
|
||||
UID: "c89a5111-b2e9-4af8-be19-c2a4a924c256",
|
||||
},
|
||||
},
|
||||
}}
|
||||
{
|
||||
Hostname: "myapp.nossl",
|
||||
},
|
||||
}
|
||||
|
||||
server := &httptest.Server{
|
||||
Listener: listener,
|
||||
|
|
@ -363,8 +368,14 @@ func TestConfigureCertificates(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, server := range servers {
|
||||
if server.SSLCert.UID != conf.Servers[server.Hostname] {
|
||||
t.Errorf("Expected servers and posted servers to be equal")
|
||||
if server.SSLCert == nil {
|
||||
if conf.Servers[server.Hostname] != emptyUID {
|
||||
t.Errorf("Expected server %s to have UID of %s but got %s", server.Hostname, emptyUID, conf.Servers[server.Hostname])
|
||||
}
|
||||
} else {
|
||||
if server.SSLCert.UID != conf.Servers[server.Hostname] {
|
||||
t.Errorf("Expected server %s to have UID of %s but got %s", server.Hostname, server.SSLCert.UID, conf.Servers[server.Hostname])
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue