Reduce time of license creations in specs
Problem
In !107424 (merged) we've stopped creating license by default for CE or with tag :without_license
. We still create a starter license in EE specs by default or with tag :with_license
.
So, instead of creating a single License instance per spec suite we are creating license depending on the context.
According to !121024 (closed) we are spending ~36 minutes (or 2230 seconds) in creating test licenses in specs:
- Amount of licenses created: 13298 records
- Total runtime of license key generations: 2230 seconds
- Total runtime of factory geneartions: 129 seconds
- Total runtime: 2359 seconds
Proposed solution
Options:
-
Generate license key once and memoize it - !121052 (merged) -
Investigate why so many test licenses are created in EE specs - For example: https://gitlab.com/gitlab-org/gitlab/-/jobs/4301288115 runs EE-only specs but creates 182 licenses
- Only create a license if not present?
-
Avoid factory creations/removals by stubbing calls to License.current
or usingstub_licensed_features
.
Refs
- Contributes to https://gitlab.com/gitlab-com/gitlab-OKRs/-/work_items/2471.
Edited by Peter Leitzen