Skip to content

Change the created add date of the security scan so that they are different.

What does this MR do and why?

There are two specs related to this file that are currently failing in PG 11 (https://gitlab.com/gitlab-org/gitlab/-/jobs/2502288132).

The cause seems to be that security_scan_1 and security_scan_2 are created at the same exact time, when running Gitlab::BackgroundMigration::PurgeStaleSecurityScans::SecurityScan.last_stale_record_id (ran by to_purge), it will return the id of security_scan_1.id in PG11, but security_scan_2.id in PG12. That means that in PG11 we only purge security_scan_1 (and everything below that id, which is nothing), whereas in PG12 we (correctly) purge security_scan_2 and lower id's (including security_scan_1).

I doubt this will come up in a real application, since we won't create two security scans at the exact same time, so just a fix for the PG11 spec here

How to set up and validate locally

Run the spec with PG 11. I added the pipeline:run-all-rspec label so the pipeline will run specs in both PG11 and 12.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Roy Zwambag

Merge request reports