Skip to content

Order-dependent spec: rspec ./spec/requests/api/graphql/mutations/work_items/update_spec.rb:209 # Update a work item when user has permissions to update a work item with hierarchy widget input when updating parent when parent work item type is invalid ret

The following discussion from !92864 (merged) should be addressed:

  • @splattael started a discussion:

    Question (non-blocking)

    While testing the code here I found that the specs are order-dependent and fail with a given seed:

    bin/rspec --seed 14775  spec/requests/api/graphql/mutations/work_items/update_spec.rb
    
    Failures:
    
      1) Update a work item when user has permissions to update a work item with hierarchy widget input when updating parent when parent work item type is invalid returns response with errors
         Failure/Error:
           expect do
             post_graphql_mutation(mutation, current_user: current_user)
             work_item.reload
           end.to not_change(work_item, :work_item_parent).and(not_change(work_item, :title))
    
           expected `WorkItem#work_item_parent` not to have changed, but did change from #<WorkItem id:42 namespace1/project1#3> to nil
         # ./spec/requests/api/graphql/mutations/work_items/update_spec.rb:210:in `block (6 levels) in <top (required)>'
         # ./spec/spec_helper.rb:426:in `block (3 levels) in <top (required)>'
         # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
         # ./spec/spec_helper.rb:417:in `block (2 levels) in <top (required)>'
         # ./spec/spec_helper.rb:413:in `block (3 levels) in <top (required)>'
         # ./lib/gitlab/application_context.rb:52:in `with_raw_context'
         # ./spec/spec_helper.rb:413:in `block (2 levels) in <top (required)>'
         # ./spec/spec_helper.rb:264:in `block (2 levels) in <top (required)>'
         # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
         # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <main>'
         # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
         # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <main>'
    
    Finished in 21.43 seconds (files took 6.94 seconds to load)
    23 examples, 1 failure
    
    Failed examples:
    
    rspec ./spec/requests/api/graphql/mutations/work_items/update_spec.rb:209 # Update a work item when user has permissions to update a work item with hierarchy widget input when updating parent when parent work item type is invalid returns response with errors
    
    Randomized with seed 14775

    I'll create a follow-up.