mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
fix: correctly reject quota-violating builds (#9233)
Due to a logical error in CommitQuota, all workspace Stop->Start operations were being accepted, regardless of the Quota limit. This issue only appeared after #9201, so this was a minor regression in main for about 3 days. This PR adds a test to make sure this kind of bug doesn't recur. To make the new test possible, we give the echo provisioner the ability to simulate responses to specific transitions.
This commit is contained in:
@ -498,7 +498,10 @@ func (api *API) updateEntitlements(ctx context.Context) error {
|
||||
|
||||
if initial, changed, enabled := featureChanged(codersdk.FeatureTemplateRBAC); shouldUpdate(initial, changed, enabled) {
|
||||
if enabled {
|
||||
committer := committer{Database: api.Database}
|
||||
committer := committer{
|
||||
Log: api.Logger.Named("quota_committer"),
|
||||
Database: api.Database,
|
||||
}
|
||||
ptr := proto.QuotaCommitter(&committer)
|
||||
api.AGPL.QuotaCommitter.Store(&ptr)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user