Skip to content

Fix flaky csv_service_spec

Mehmet Emin INAC requested to merge minac_336377_address_flaky_spec into master

What does this MR do and why?

This MR aims to address a flaky spec. The reason that the spec is flaky because we are calling a collection association of the Vulnerability model and expecting the results to be consistently ordered but there is no guarantee that PostgreSQL will return the records in the order they are created.

Here is a simplified pseudo code to highlight the problematic part of this spec;

vulnerability.identifiers << crete_identifier_1
vulnerability.identifiers << crete_identifier_2

Vulnerability.all.first.finding.identifiers # There is no guarantee of the order of the records here

And the simplified pseudo code to highlight the fix applied in this MR;

vulnerability.identifiers << crete_identifier_1
vulnerability.identifiers << crete_identifier_2

vulnerability.identifiers # As we are calling identifiers directly on the in-memory object, the order is guaranteed

Related to VulnerabilityExports::Exporters::CsvService CSV... (#336377 - closed).

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 Mehmet Emin INAC

Merge request reports