Skip to content

Commit

Permalink
Fix error in TestGetCertExpireTime()
Browse files Browse the repository at this point in the history
  • Loading branch information
nomeguy committed Oct 9, 2023
1 parent e594527 commit 7f89b04
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions object/cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,29 @@ import (
func TestGetCertExpireTime(t *testing.T) {
InitConfig()

cert := getCert("admin", "casbin.com")
cert, err := getCert("admin", "casbin.com")
if err != nil {
panic(err)
}

println(getCertExpireTime(cert.Certificate))
}

func TestRenewAllCerts(t *testing.T) {
InitConfig()
proxy.InitHttpClient()

certs := GetCerts("admin")
certs, err := GetCerts("admin")
if err != nil {
panic(err)
}

for i, cert := range certs {
res := RenewCert(cert)
res, err := RenewCert(cert)
if err != nil {
panic(err)
}

fmt.Printf("[%d/%d] Renewed cert: [%s] to [%s], res = %v\n", i+1, len(certs), cert.Name, cert.ExpireTime, res)
}
}
Expand All @@ -47,7 +59,11 @@ func TestApplyAllCerts(t *testing.T) {
InitConfig()

baseDir := "F:/github_repos/nginx/conf/ssl"
certs := GetCerts("admin")
certs, err := GetCerts("admin")
if err != nil {
panic(err)
}

for _, cert := range certs {
if cert.Certificate == "" || cert.PrivateKey == "" {
continue
Expand Down

0 comments on commit 7f89b04

Please sign in to comment.