Skip to content

Commit

Permalink
UD cache flush for Erratum in CVE fix task [RHELDST-16262] (release-e…
Browse files Browse the repository at this point in the history
…ngineering#201)

Added UD cache flush of Erratum object in CVE fix task.
With this fix Erratum related to given CVE should be
available on Customer portal pages without delay.
  • Loading branch information
rbikar authored Mar 22, 2023
1 parent a015425 commit 76d637e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- n/a
- Added UD cache flush of Erratum object in CVE fix task

## [1.22.0] - 2023-03-01

Expand Down
2 changes: 1 addition & 1 deletion pubtools/_pulp/tasks/fix_cves.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def run(self):
self.upload_erratum(erratum, repos)

# Publish repos
self.publish_with_cache_flush(repos)
self.publish_with_cache_flush(repos, errata=[erratum])


def entry_point(cls=FixCves):
Expand Down
20 changes: 20 additions & 0 deletions tests/fix_cves/test_fix_cves.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class FakeUdCache(object):
def __init__(self):
self.flushed_repos = []
self.flushed_products = []
self.flushed_errata = []

def flush_repo(self, repo_id):
self.flushed_repos.append(repo_id)
Expand All @@ -30,6 +31,10 @@ def flush_product(self, product_id):
self.flushed_products.append(product_id)
return f_return()

def flush_erratum(self, erratum_id):
self.flushed_errata.append(erratum_id)
return f_return()


class FakeFastPurge(object):
def __init__(self):
Expand Down Expand Up @@ -199,6 +204,21 @@ def test_fix_cves_with_cache_cleanup(command_tester):
],
)

ud_client = fake_fix_cves.udcache_client

assert ud_client.flushed_repos == ["all-rpm-content", "repo"]
assert ud_client.flushed_products == []
assert ud_client.flushed_errata == ["RHSA-1234:56"]

fastpurge_client = fake_fix_cves.fastpurge_client

assert fastpurge_client.purged_urls == [
"https://cdn.example.com/content/unit/1/all-rpm/mutable1",
"https://cdn.example.com/content/unit/1/all-rpm/mutable2",
"https://cdn.example.com/content/unit/1/client/mutable1",
"https://cdn.example.com/content/unit/1/client/mutable2",
]


def test_no_erratum_found_error(command_tester):
with FakeFixCves() as fake_fix_cves:
Expand Down

0 comments on commit 76d637e

Please sign in to comment.