Skip to content

Use previous license term for seat overage

What does this MR do?

Part of #281177 (closed)

To get the current seat overage the historical max data is pulled for the past year. But not every license runs for a year. There was also an overlap for new licenses to the old one which was removed with https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/2635.

This change will take a previous license's term to pull the historical max data and only use the past year as a fallback.

How to test

In LicenseDot:

  1. Create a license with a start date of 2019-02-15 and and expiration date of 2020-02-15
  2. Create another license with a start date of 2020-02-01 and and expiration date of 2021-02-15

In GitLab:

  1. Create a HistoricalData entry for 100 users and set recorded_at to 2019-02-12
  2. Create another HistoricalData entry for 50 users and set recorded_at to 2019-02-13

In the rails console:

  1. Without the changes:
    • Call License.current.send(:prior_historical_max)
    • See that the query uses the period between the 2019-02-01 and 2020-02-01 (start date of the current license - 1 year and start date of the current license)
    • Returns 100
  2. With the changes:
    • Call License.current.send(:prior_historical_max)
    • See that the query uses the period between the 2019-02-15 and 2020-02-15 (start date and expiration date of the previous license)
    • Returns 0 (when no data exists for that period otherwise the max entry from that period but not the 100 as previously)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Corinna Gogolok

Merge request reports