Skip to content

Add user fixture creation script

This script is intended to be used to create a large number of users, and add them to a group for the purposes of establishing some fixture data for a test.

Dry-run-by-default and tear-down functionality is included.

The test case will assist in the simulation or recreation of the circumstances of a problematic situation in which removing a group share from another group with a large number of members causes a large quantity of sidekiq jobs to be invoked simultaneously, which in turn causes a potentially dangerous increase in CPU saturation on the postgresql database of the primary patroni instance.

This code does not conduct the actual operation which will initiate the experiment. Instead, it only creates the test data fixtures required for the experiment. It also provides a mechanism to tear down that fixture data. Only the fixture data is ever operated on by this script. The script ensures this by identifying all created data with a unique 64-character alphanumeric key generated by the openssl random number facility.

This script does not yet include any unit tests at this time, because it is intended that this script only ever be ran in the staging or non-production environment. However, I am happy to add such unit tests if required, or if it is acceptable, we could simply delete this script from this repository after it has served its purpose to prevent any accidental invocation in production by some other user. Alternatively, this MR does not have to get merged at all -- I am only creating this MR as a means to the end of having this script peer-reviewed as a required component of a staging-only change plan: https://gitlab.com/gitlab-com/gl-infra/production/-/issues/7387

See: https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/15955

Edited by Nels Nelson

Merge request reports