Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky ExportCreateService spec #4862

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

coalest
Copy link
Collaborator

@coalest coalest commented Dec 16, 2024

Doesn't resolve any issue.

Description

I believe this is one of the more flaky specs we have.

This spec expects the requests in the export to be in a particular order, but no order is applied to the requests passed in and no order is defined in the ExportCreateService itself, hence the flakiness.

Example rspec output:


Failures:

  1) Exports::ExportRequestService with custom units feature enabled .generate_csv_data has expected data for the 2T Diapers request
     Failure/Error:
       expect(subject[2]).to eq([
         request_2t.created_at.strftime("%m/%d/%Y").to_s,
         "Howdy Partner",
         "Individual",
         "Fulfilled",
         100, # 2T Diapers
         0,   # 3T Diapers
         0,   # 4T Diapers
         0,   # 4T Diapers - packs
         0    # <DELETED_ITEMS>

       expected: ["12/16/2024", "Howdy Partner", "Individual", "Fulfilled", 100, 0, 0, 0, 0]
            got: ["12/16/2024", "Howdy Partner", "Child", "Started", 0, 150, 0, 0, 0]

       (compared using ==)
     # ./spec/services/exports/export_request_service_spec.rb:130:in `block (4 levels) in <top (required)>'

Explanation: is expecting the the second line to equal the second request defined in the setup. But since Request.all are the arguments, no order is defined, and that request is there but on a different line.

Type of change

  • Internal (test refactor)

How Has This Been Tested?

It's hard to reproduce this flakiness on command. While I was debugging it, I ran --bisect with the seed number, but it wasn't helpful in this case.

It's possible this test is flaky for a different reason. But let's take care of this issue first.

Screenshots

Example failure in CI: https://github.com/rubyforgood/human-essentials/actions/runs/12353561322/job/34472934783#step:7:1433

This test expects the requests in the export to be in a particular order,
but no order is applied to the requests passed in and no order is defined
in the ExportCreateService itself, hence the flakiness.

Example failure: https://github.com/rubyforgood/human-essentials/actions/runs/12353561322/job/34472934783#step:7:1433
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant