forked from TrueCloudLab/certificates
Fix tests: certs are truncated to seconds.
This commit is contained in:
parent
8ef8f4f665
commit
389815642d
10 changed files with 11 additions and 11 deletions
|
@ -91,7 +91,7 @@ func TestACME_Init(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestACME_AuthorizeRenew(t *testing.T) {
|
func TestACME_AuthorizeRenew(t *testing.T) {
|
||||||
now := time.Now()
|
now := time.Now().Truncate(time.Second)
|
||||||
type test struct {
|
type test struct {
|
||||||
p *ACME
|
p *ACME
|
||||||
cert *x509.Certificate
|
cert *x509.Certificate
|
||||||
|
|
|
@ -824,7 +824,7 @@ func TestAWS_AuthorizeSSHSign(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAWS_AuthorizeRenew(t *testing.T) {
|
func TestAWS_AuthorizeRenew(t *testing.T) {
|
||||||
now := time.Now()
|
now := time.Now().Truncate(time.Second)
|
||||||
p1, err := generateAWS()
|
p1, err := generateAWS()
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
p2, err := generateAWS()
|
p2, err := generateAWS()
|
||||||
|
|
|
@ -536,7 +536,7 @@ func TestAzure_AuthorizeSign(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAzure_AuthorizeRenew(t *testing.T) {
|
func TestAzure_AuthorizeRenew(t *testing.T) {
|
||||||
now := time.Now()
|
now := time.Now().Truncate(time.Second)
|
||||||
p1, err := generateAzure()
|
p1, err := generateAzure()
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
p2, err := generateAzure()
|
p2, err := generateAzure()
|
||||||
|
|
|
@ -122,7 +122,7 @@ func DefaultAuthorizeRenew(ctx context.Context, p *Controller, cert *x509.Certif
|
||||||
|
|
||||||
now := time.Now().Truncate(time.Second)
|
now := time.Now().Truncate(time.Second)
|
||||||
if now.Before(cert.NotBefore) {
|
if now.Before(cert.NotBefore) {
|
||||||
return errs.Unauthorized("certificate is not yet valid")
|
return errs.Unauthorized("certificate is not yet valid" + " " + now.UTC().Format(time.RFC3339Nano) + " vs " + cert.NotBefore.Format(time.RFC3339Nano))
|
||||||
}
|
}
|
||||||
if now.After(cert.NotAfter) && !p.Claimer.IsRenewAfterExpiry() {
|
if now.After(cert.NotAfter) && !p.Claimer.IsRenewAfterExpiry() {
|
||||||
return errs.Unauthorized("certificate has expired")
|
return errs.Unauthorized("certificate has expired")
|
||||||
|
|
|
@ -134,7 +134,7 @@ func TestController_GetIdentity(t *testing.T) {
|
||||||
|
|
||||||
func TestController_AuthorizeRenew(t *testing.T) {
|
func TestController_AuthorizeRenew(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
now := time.Now()
|
now := time.Now().Truncate(time.Second)
|
||||||
type fields struct {
|
type fields struct {
|
||||||
Interface Interface
|
Interface Interface
|
||||||
Claimer *Claimer
|
Claimer *Claimer
|
||||||
|
@ -276,7 +276,7 @@ func TestController_AuthorizeSSHRenew(t *testing.T) {
|
||||||
|
|
||||||
func TestDefaultAuthorizeRenew(t *testing.T) {
|
func TestDefaultAuthorizeRenew(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
now := time.Now()
|
now := time.Now().Truncate(time.Second)
|
||||||
type args struct {
|
type args struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
p *Controller
|
p *Controller
|
||||||
|
|
|
@ -698,7 +698,7 @@ func TestGCP_AuthorizeSSHSign(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGCP_AuthorizeRenew(t *testing.T) {
|
func TestGCP_AuthorizeRenew(t *testing.T) {
|
||||||
now := time.Now()
|
now := time.Now().Truncate(time.Second)
|
||||||
p1, err := generateGCP()
|
p1, err := generateGCP()
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
p2, err := generateGCP()
|
p2, err := generateGCP()
|
||||||
|
|
|
@ -325,7 +325,7 @@ func TestJWK_AuthorizeSign(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJWK_AuthorizeRenew(t *testing.T) {
|
func TestJWK_AuthorizeRenew(t *testing.T) {
|
||||||
now := time.Now()
|
now := time.Now().Truncate(time.Second)
|
||||||
p1, err := generateJWK()
|
p1, err := generateJWK()
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
p2, err := generateJWK()
|
p2, err := generateJWK()
|
||||||
|
|
|
@ -179,7 +179,7 @@ func TestK8sSA_AuthorizeRevoke(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestK8sSA_AuthorizeRenew(t *testing.T) {
|
func TestK8sSA_AuthorizeRenew(t *testing.T) {
|
||||||
now := time.Now()
|
now := time.Now().Truncate(time.Second)
|
||||||
type test struct {
|
type test struct {
|
||||||
p *K8sSA
|
p *K8sSA
|
||||||
cert *x509.Certificate
|
cert *x509.Certificate
|
||||||
|
|
|
@ -411,7 +411,7 @@ func TestOIDC_AuthorizeRevoke(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOIDC_AuthorizeRenew(t *testing.T) {
|
func TestOIDC_AuthorizeRenew(t *testing.T) {
|
||||||
now := time.Now()
|
now := time.Now().Truncate(time.Second)
|
||||||
p1, err := generateOIDC()
|
p1, err := generateOIDC()
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
p2, err := generateOIDC()
|
p2, err := generateOIDC()
|
||||||
|
|
|
@ -552,7 +552,7 @@ func TestX5C_AuthorizeRevoke(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestX5C_AuthorizeRenew(t *testing.T) {
|
func TestX5C_AuthorizeRenew(t *testing.T) {
|
||||||
now := time.Now()
|
now := time.Now().Truncate(time.Second)
|
||||||
type test struct {
|
type test struct {
|
||||||
p *X5C
|
p *X5C
|
||||||
code int
|
code int
|
||||||
|
|
Loading…
Reference in a new issue