Skip to content

Commit

Permalink
add 365 days instead of 1 year to account for leap years
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkermichael committed Mar 1, 2023
1 parent 1ab2cac commit b68593f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion control-plane/subcommand/tls-init/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ func TestRun_CreatesServerCertificatesWithExpiryWithinSpecifiedDays(t *testing.T
certBlock, _ := pem.Decode(newServerCert)
certificate, err := x509.ParseCertificate(certBlock.Bytes)
require.NoError(t, err)
require.Equal(t, time.Now().AddDate(1, 0, 0).Unix(), certificate.NotAfter.Unix())

// Add 365 days instead of 1 year to account for leap years
require.Equal(t, time.Now().AddDate(0, 0, 365).Unix(), certificate.NotAfter.Unix())
}

func TestRun_CreatesServerCertificatesWithProvidedHosts(t *testing.T) {
Expand Down

0 comments on commit b68593f

Please sign in to comment.