@@ -33,8 +33,8 @@ func TestVaultRenewDuration(t *testing.T) {
3333 if err != nil {
3434 t .Fatal (err )
3535 }
36- if nonRenewableDur . Seconds () < 80 || nonRenewableDur . Seconds () > 95 {
37- t .Fatalf ("renewable duration is not within 80%% to 95%% of lease duration: %f " , nonRenewableDur . Seconds () )
36+ if nonRenewableDur < 80 * time . Second || nonRenewableDur > 95 * time . Second {
37+ t .Fatalf ("renewable duration is not within 80%% to 95%% of lease duration: %s " , nonRenewableDur )
3838 }
3939
4040 data := map [string ]interface {}{
@@ -49,8 +49,8 @@ func TestVaultRenewDuration(t *testing.T) {
4949 }
5050
5151 // We expect a 1 second cushion
52- if nonRenewableRotatedDur . Seconds () != 31 {
53- t .Fatalf ("renewable duration is not 31: %f " , nonRenewableRotatedDur . Seconds () )
52+ if nonRenewableRotatedDur != 31 * time . Second {
53+ t .Fatalf ("renewable duration is not 31: %s " , nonRenewableRotatedDur )
5454 }
5555
5656 data = map [string ]interface {}{
@@ -65,8 +65,8 @@ func TestVaultRenewDuration(t *testing.T) {
6565 }
6666
6767 // We expect a 1 second cushion
68- if nonRenewableRotatedDur . Seconds () != 6 {
69- t .Fatalf ("renewable duration is not 6: %f " , nonRenewableRotatedDur . Seconds () )
68+ if nonRenewableRotatedDur != 6 * time . Second {
69+ t .Fatalf ("renewable duration is not 6: %s " , nonRenewableRotatedDur )
7070 }
7171
7272 // Test TTL=0 case - should return error
@@ -96,8 +96,8 @@ func TestVaultRenewDuration(t *testing.T) {
9696 if err != nil {
9797 t .Fatal (err )
9898 }
99- if nonRenewableCertDur . Seconds () < 80 || nonRenewableCertDur . Seconds () > 95 {
100- t .Fatalf ("non renewable certificate duration is not within 80%% to 95%%: %f " , nonRenewableCertDur . Seconds () )
99+ if nonRenewableCertDur < 80 * time . Second || nonRenewableCertDur > 95 * time . Second {
100+ t .Fatalf ("non renewable certificate duration is not within 80%% to 95%%: %s " , nonRenewableCertDur )
101101 }
102102
103103 t .Run ("secret ID handling" , func (t * testing.T ) {
@@ -115,7 +115,7 @@ func TestVaultRenewDuration(t *testing.T) {
115115 }
116116
117117 if nonRenewableSecretIDDur .Seconds () < 0.80 * (60 + 1 ) || nonRenewableSecretIDDur .Seconds () > 0.95 * (60 + 1 ) {
118- t .Fatalf ("renewable duration is not within 80%% to 95%% of lease duration: %f " , nonRenewableSecretIDDur . Seconds () )
118+ t .Fatalf ("renewable duration is not within 80%% to 95%% of lease duration: %s " , nonRenewableSecretIDDur )
119119 }
120120 })
121121
@@ -134,7 +134,7 @@ func TestVaultRenewDuration(t *testing.T) {
134134 }
135135
136136 if nonRenewableSecretIDDur .Seconds () < 0.80 * (leaseDuration + 1 ) || nonRenewableSecretIDDur .Seconds () > 0.95 * (leaseDuration + 1 ) {
137- t .Fatalf ("renewable duration is not within 80%% to 95%% of lease duration: %f " , nonRenewableSecretIDDur . Seconds () )
137+ t .Fatalf ("renewable duration is not within 80%% to 95%% of lease duration: %s " , nonRenewableSecretIDDur )
138138 }
139139 })
140140
@@ -152,7 +152,7 @@ func TestVaultRenewDuration(t *testing.T) {
152152 }
153153
154154 if nonRenewableSecretIDDur .Seconds () < 0.80 * (leaseDuration + 1 ) || nonRenewableSecretIDDur .Seconds () > 0.95 * (leaseDuration + 1 ) {
155- t .Fatalf ("renewable duration is not within 80%% to 95%% of lease duration: %f " , nonRenewableSecretIDDur . Seconds () )
155+ t .Fatalf ("renewable duration is not within 80%% to 95%% of lease duration: %s " , nonRenewableSecretIDDur )
156156 }
157157 })
158158 })
0 commit comments