Skip to content

Commit

Permalink
Improve TestRenewAllCerts()
Browse files Browse the repository at this point in the history
  • Loading branch information
nomeguy committed May 5, 2024
1 parent c356558 commit 378f782
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions object/cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,29 @@ func TestRenewAllCerts(t *testing.T) {
panic(err)
}

for i, cert := range certs {
filteredCerts := []*Cert{}
for _, cert := range certs {
if cert.Owner != "admin" || cert.Provider == "" {
continue
}

if cert.Provider == "GoDaddy" {
continue
}

var nearExpire bool
nearExpire, err = cert.isCertNearExpire()
if err != nil {
panic(err)
}
if !nearExpire {
continue
}

filteredCerts = append(filteredCerts, cert)
}

for i, cert := range filteredCerts {
if cert.Owner != "admin" || cert.Provider == "" {
continue
}
Expand All @@ -92,7 +114,7 @@ func TestRenewAllCerts(t *testing.T) {
panic(err)
}

fmt.Printf("[%d/%d] Renewed cert: [%s] to [%s], res = %v\n", i+1, len(certs), cert.Name, cert.ExpireTime, res)
fmt.Printf("[%d/%d] Renewed cert: [%s] to [%s], res = %v\n", i+1, len(filteredCerts), cert.Name, cert.ExpireTime, res)
}
}

Expand Down

0 comments on commit 378f782

Please sign in to comment.