Skip to content

Commit

Permalink
fix(taskomatic): don't hide stale_warning systems
Browse files Browse the repository at this point in the history
VULN-2825
  • Loading branch information
jdobes authored and yungbender committed Nov 1, 2023
1 parent cf163a5 commit 8a74ba9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion database/schema/ve_db_dev_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ INSERT INTO system_platform (id, inventory_id, display_name, rh_account_id, s3_u
(13, '00000000-0000-0000-0000-000000000013', 'inv-13.example.com', 0, 'https://s3/13', '{ "package_list": [ "kernel-2.6.32-696.20.1.el6.x86_64" ]}', '1', '2018-09-22 12:00:00-04', '2018-09-22 12:00:00-04', '2018-09-23 12:00:00-04', '2'),
(14, '00000000-0000-0000-0000-000000000014', 'inv-14.example.com', 0, 'https://s3/14', '{ "package_list": [ "kernel-2.6.32-696.20.1.el6.x86_64" ]}', '1', '2018-09-22 12:00:00-04', '2018-09-22 12:00:00-04', '2018-09-23 12:00:00-04', '2');

INSERT INTO system_platform (id, inventory_id, display_name, rh_account_id, s3_url, vmaas_json, json_checksum, last_upload, last_evaluation, advisor_evaluated, stale_warning_timestamp, stale, advisor_checksum) VALUES
INSERT INTO system_platform (id, inventory_id, display_name, rh_account_id, s3_url, vmaas_json, json_checksum, last_upload, last_evaluation, advisor_evaluated, culled_timestamp, stale, advisor_checksum) VALUES
(15, '00000000-0000-0000-0000-000000000015', 'inv-15.example.com', 0, 'https://s3/15', '{ "package_list": [ "kernel-2.6.32-696.20.1.el6.x86_64" ]}', '1', NULL, NULL, '2018-09-23 12:00:00-04', '2020-01-01 00:00:00-04', 'F', '2'),
(16, '00000000-0000-0000-0000-000000000016', 'inv-16.example.com', 0, 'https://s3/16', '{ "package_list": [ "kernel-2.6.32-696.20.1.el6.x86_64" ]}', '1', NULL, NULL, '2018-09-23 12:00:00-04', '2020-01-01 00:00:00-04', 'T', '2'),
(17, '00000000-0000-0000-0000-000000000017', 'inv-17.example.com', 0, 'https://s3/17', '{ "package_list": [ "kernel-2.6.32-696.20.1.el6.x86_64" ]}', '1', NULL, NULL, '2018-09-23 12:00:00-04', '2020-01-01 00:00:00-04', 'F', '2');
Expand Down
4 changes: 2 additions & 2 deletions taskomatic/jobs/stale_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def run():
SELECT id
FROM system_platform
WHERE when_deleted IS NULL
AND stale_warning_timestamp IS NOT NULL
AND culled_timestamp IS NOT NULL
AND stale = FALSE
AND now() > stale_warning_timestamp
AND now() > culled_timestamp
ORDER BY id
) AS subquery
WHERE system_platform.id = subquery.id
Expand Down
14 changes: 7 additions & 7 deletions tests/taskomatic_tests/test_stale_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ def test_stale_systems(pg_db_conn, monkeypatch):
cur.execute(
"""SELECT count(id) from system_platform sp
WHERE when_deleted IS NULL
AND stale_warning_timestamp IS NOT NULL
AND culled_timestamp IS NOT NULL
AND stale = 'F'
AND now() > stale_warning_timestamp"""
AND now() > culled_timestamp"""
)
to_mark = cur.fetchone()[0]
assert to_mark == 2
cur.execute(
"""SELECT count(id) from system_platform sp
WHERE when_deleted IS NULL
AND stale_warning_timestamp IS NOT NULL
AND culled_timestamp IS NOT NULL
AND stale = 'T'"""
)
already_stale = cur.fetchone()[0]
Expand All @@ -39,16 +39,16 @@ def test_stale_systems(pg_db_conn, monkeypatch):
cur.execute(
"""SELECT count(id) from system_platform sp
WHERE when_deleted IS NULL
AND stale_warning_timestamp IS NOT NULL
AND culled_timestamp IS NOT NULL
AND stale = 'F'
AND now() > stale_warning_timestamp"""
AND now() > culled_timestamp"""
)
staling = cur.fetchone()[0]
assert staling == 0
cur.execute(
"""SELECT count(id) from system_platform sp
WHERE when_deleted IS NULL
AND stale_warning_timestamp IS NOT NULL
WHERE when_deleted IS NOT NULL
AND culled_timestamp IS NOT NULL
AND stale = 'T'"""
)
stale = cur.fetchone()[0]
Expand Down

0 comments on commit 8a74ba9

Please sign in to comment.