Skip to content

Call cleanup worker

Bishwa Hang Rai requested to merge 415302-enqueue-cleanup-worker into master

What does this MR do and why?

This MR is follow up for the MR: Add cleanup worker (!130622 - merged)

In this MR, we call the CleanupUserAddOnAssignmentWorker, whenever the member record is destroyed.

Screenshots or screen recordings

Screen_Recording_2023-09-04_at_16.40.06

How to set up and validate locally

  1. Check out this branch
  2. Create a new root group namespace
  3. Setup some seed records
namespace = Namespace.last
add_on = GitlabSubscriptions::AddOn.find_or_create_by!(name: "code_suggestions") {|e| e.description = "Test"}
add_on_purchase = GitlabSubscriptions::AddOnPurchase.create!(
  add_on: add_on, namespace: namespace, expires_on: 1.month.from_now, quantity: 5, purchase_xid: 'A-S0001'
)

# enable the feature flag
Feature.enable(:hamilton_seat_management)


current_user = User.find 69 # John Doe6
member_user = User.find 70 # John Doe7

# add user
namespace.add_owner(current_user)
member = namespace.add_developer(member_user)

# assign seat to the user
add_on_purchase.assigned_users.create(user: member_user)
add_on_purchase.assigned_users.count # 1

# delete membership
Members::DestroyService.new(current_user).execute(member)

# check assigned_users count
add_on_purchase.assigned_users.count # 1
  1. Please also check the ## Screenshots or screen recordings to perform the test visually as owner/admin of a group.

MR acceptance checklist

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

Related to #415302

Edited by Bishwa Hang Rai

Merge request reports

Loading