Invalidate cloud caches when a new license is loaded (#21579)
Automatic Merge
Этот коммит содержится в:
@@ -289,6 +289,10 @@ func (l *License) IsStarted() bool {
|
||||
return l.StartsAt < GetMillis()
|
||||
}
|
||||
|
||||
func (l *License) IsCloud() bool {
|
||||
return l != nil && l.Features != nil && l.Features.Cloud != nil && *l.Features.Cloud
|
||||
}
|
||||
|
||||
func (l *License) IsTrialLicense() bool {
|
||||
return l.IsTrial || (l.ExpiresAt-l.StartsAt) == trialDuration.Milliseconds() || (l.ExpiresAt-l.StartsAt) == adminTrialDuration.Milliseconds()
|
||||
}
|
||||
|
||||
@@ -143,6 +143,23 @@ func TestLicenseIsStarted(t *testing.T) {
|
||||
assert.False(t, l1.IsStarted())
|
||||
}
|
||||
|
||||
func TestIsCloud(t *testing.T) {
|
||||
l1 := License{}
|
||||
l1.Features = &Features{}
|
||||
l1.Features.SetDefaults()
|
||||
assert.False(t, l1.IsCloud())
|
||||
|
||||
boolTrue := true
|
||||
l1.Features.Cloud = &boolTrue
|
||||
assert.True(t, l1.IsCloud())
|
||||
|
||||
var license *License
|
||||
assert.False(t, license.IsCloud())
|
||||
|
||||
l1.Features = nil
|
||||
assert.False(t, l1.IsCloud())
|
||||
}
|
||||
|
||||
func TestLicenseRecordIsValid(t *testing.T) {
|
||||
lr := LicenseRecord{
|
||||
CreateAt: GetMillis(),
|
||||
|
||||
Ссылка в новой задаче
Block a user