Fix the expiration by version logic (#450)
* Fix the expiration by version logic * Address review comments
This commit is contained in:
Родитель
d1ec5ec11a
Коммит
7a1f2b2d06
|
@ -2,6 +2,8 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
- Fix the logic for the metric expiration by version ([bug 1753194](https://bugzilla.mozilla.org/show_bug.cgi?id=1753194))
|
||||
|
||||
## 5.0.0
|
||||
|
||||
- Remove C# support ([#436](https://github.com/mozilla/glean_parser/pull/436)).
|
||||
|
|
|
@ -418,7 +418,7 @@ def is_expired(expires: str, major_version: Optional[int] = None) -> bool:
|
|||
elif expires == "expired":
|
||||
return True
|
||||
elif major_version is not None:
|
||||
return parse_expiration_version(expires) >= major_version
|
||||
return parse_expiration_version(expires) <= major_version
|
||||
else:
|
||||
date = parse_expiration_date(expires)
|
||||
return date <= datetime.datetime.utcnow().date()
|
||||
|
|
|
@ -641,7 +641,11 @@ def test_expire_by_major_version():
|
|||
"category": {
|
||||
"metric_expired_version": {
|
||||
"type": "boolean",
|
||||
"expires": 18,
|
||||
"expires": 7,
|
||||
},
|
||||
"metric_expired_edge": {
|
||||
"type": "boolean",
|
||||
"expires": 15,
|
||||
},
|
||||
"metric_expired": {
|
||||
"type": "boolean",
|
||||
|
@ -649,7 +653,7 @@ def test_expire_by_major_version():
|
|||
},
|
||||
"metric": {
|
||||
"type": "boolean",
|
||||
"expires": 7,
|
||||
"expires": 18,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -666,6 +670,7 @@ def test_expire_by_major_version():
|
|||
errors = list(all_metrics)
|
||||
assert len(errors) == 0
|
||||
assert all_metrics.value["category"]["metric_expired_version"].disabled is True
|
||||
assert all_metrics.value["category"]["metric_expired_edge"].disabled is True
|
||||
assert all_metrics.value["category"]["metric_expired"].disabled is True
|
||||
assert all_metrics.value["category"]["metric"].disabled is False
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче