@@ -112,10 +112,10 @@ func TestEntitlements(t *testing.T) {
112
112
codersdk .FeatureAuditLog : 1 ,
113
113
},
114
114
115
- GraceAt : time .Now ().Add ( - time . Hour ),
116
- ExpiresAt : time .Now ().AddDate (0 , 0 , 2 ),
115
+ GraceAt : time .Now ().AddDate ( 0 , 0 , 2 ),
116
+ ExpiresAt : time .Now ().AddDate (0 , 0 , 5 ),
117
117
}),
118
- Exp : time .Now ().Add ( time . Hour ),
118
+ Exp : time .Now ().AddDate ( 0 , 0 , 5 ),
119
119
})
120
120
121
121
entitlements , err := license .Entitlements (context .Background (), db , slog.Logger {}, 1 , 1 , coderdenttest .Keys , all )
@@ -124,7 +124,7 @@ func TestEntitlements(t *testing.T) {
124
124
require .True (t , entitlements .HasLicense )
125
125
require .False (t , entitlements .Trial )
126
126
127
- require .Equal (t , codersdk .EntitlementGracePeriod , entitlements .Features [codersdk .FeatureAuditLog ].Entitlement )
127
+ require .Equal (t , codersdk .EntitlementEntitled , entitlements .Features [codersdk .FeatureAuditLog ].Entitlement )
128
128
require .Contains (
129
129
t , entitlements .Warnings ,
130
130
"Your license expires in 2 days." ,
@@ -192,16 +192,18 @@ func TestEntitlements(t *testing.T) {
192
192
Features : license.Features {
193
193
codersdk .FeatureUserLimit : 10 ,
194
194
},
195
+ GraceAt : time .Now ().Add (59 * 24 * time .Hour ),
195
196
}),
196
- Exp : time .Now ().Add (time .Hour ),
197
+ Exp : time .Now ().Add (60 * 24 * time .Hour ),
197
198
})
198
199
db .InsertLicense (context .Background (), database.InsertLicenseParams {
199
200
JWT : coderdenttest .GenerateLicense (t , coderdenttest.LicenseOptions {
200
201
Features : license.Features {
201
202
codersdk .FeatureUserLimit : 1 ,
202
203
},
204
+ GraceAt : time .Now ().Add (59 * 24 * time .Hour ),
203
205
}),
204
- Exp : time .Now ().Add (time .Hour ),
206
+ Exp : time .Now ().Add (60 * 24 * time .Hour ),
205
207
})
206
208
entitlements , err := license .Entitlements (context .Background (), db , slog.Logger {}, 1 , 1 , coderdenttest .Keys , empty )
207
209
require .NoError (t , err )
0 commit comments