Merge pull request #3407 from quay/fix-npe-in-tag-expiration
Fix NPE when setting tag to not expire
This commit is contained in:
commit
21028ab3fa
2 changed files with 8 additions and 1 deletions
|
@ -421,7 +421,7 @@ def set_tag_end_ms(tag, end_ms):
|
||||||
.where(TagToRepositoryTag.tag == tag)
|
.where(TagToRepositoryTag.tag == tag)
|
||||||
.get()).repository_tag
|
.get()).repository_tag
|
||||||
|
|
||||||
old_style_tag.lifetime_end_ts = end_ms / 1000
|
old_style_tag.lifetime_end_ts = end_ms / 1000 if end_ms is not None else None
|
||||||
old_style_tag.save()
|
old_style_tag.save()
|
||||||
except TagToRepositoryTag.DoesNotExist:
|
except TagToRepositoryTag.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -214,6 +214,13 @@ def test_change_tag_expiration(timedelta, expected_timedelta, initialized_db):
|
||||||
expected_ms = (updated_tag.lifetime_start_ms + offset)
|
expected_ms = (updated_tag.lifetime_start_ms + offset)
|
||||||
assert updated_tag.lifetime_end_ms == expected_ms
|
assert updated_tag.lifetime_end_ms == expected_ms
|
||||||
|
|
||||||
|
original_end_ms, okay = change_tag_expiration(tag, None)
|
||||||
|
assert okay
|
||||||
|
assert original_end_ms == expected_ms
|
||||||
|
|
||||||
|
updated_tag = Tag.get(id=tag.id)
|
||||||
|
assert updated_tag.lifetime_end_ms is None
|
||||||
|
|
||||||
|
|
||||||
def test_set_tag_expiration_for_manifest(initialized_db):
|
def test_set_tag_expiration_for_manifest(initialized_db):
|
||||||
tag = Tag.get()
|
tag = Tag.get()
|
||||||
|
|
Reference in a new issue