Skip to content

Commit 55c21c1

Browse files
atantawiopenshift-merge-robot
authored andcommitted
fix and document test case
1 parent 0ce5cee commit 55c21c1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pkg/quotaplugins/quota-forest/quota-manager/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ A summary of the API interface to the Quota Manager follows.
189189
- refresh (effect) updates from caches
190190
- `UpdateForest(forestName)`
191191
- Undo consumer allocation: Two calls are provided to try to allocate a consumer, and if unaccepted, to undo the effect of the allocation trial. If the trial is accepted, no further action is needed. Otherwise, the undo has to be called right after the try allocation, without making any calls to change the trees or allocate/deallocate consumers. These operations are intended only during Normal mode.
192+
(Note: This design pattern puts the burden on the caller of the quota manager to make sure that TryAllocate() and UndoAllocate() are run in an atomic fashion. So, a lock is needed for that purpose. An example is provided in the TestQuotaManagerParallelTryUndoAllocation() in [quotamanagerundo_test.go](quota/quotamanagerundo_test.go))
192193
- `TryAllocate(treeName, consumerID)`
193194
- `UndoAllocate(treeName, consumerID)`
194195
- `TryAllocateForest(forestName, consumerID)`

pkg/quotaplugins/quota-forest/quota-manager/quota/quotamanagerundo_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ func TestTreeAllocateTryAndUndo(t *testing.T) {
328328
func TestForestAllocateTryAndUndo(t *testing.T) {
329329
forestName := "testForest"
330330
forestTreesSpecs := []string{testTreeSpec, serviceTreeSpec}
331-
var err error
331+
332332
// define tests
333333
var tests = []struct {
334334
name string
@@ -410,6 +410,7 @@ func TestForestAllocateTryAndUndo(t *testing.T) {
410410
tt := tt
411411
t.Run(tt.name, func(t *testing.T) {
412412
t.Parallel()
413+
var err error
413414
// After keeps the state of the quota manager after applying a test case
414415
qmAfter := quota.NewManager()
415416
initializeForestQuotaManager(t, qmAfter, forestName, forestTreesSpecs, testForestConsumersSpecMap,

0 commit comments

Comments
 (0)