Atlas › Test

Test_CancelAt

Exact test identity: go.temporal.io/server/common/quotas/TestPriorityReservationSuite/Test_CancelAt

Package
go.temporal.io/server/common/quotas
Suite / test hierarchy
TestPriorityReservationSuite/Test_CancelAt
Test
Test_CancelAt
Introduced at
priority_reservation_impl.go ×1 Frontier kind: Joint frontier
Covered ranges
7
Covered lines
27
Covered files
2

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/quotas/reservation_mock.go 16 covered LOC · 4 ranges

Open complete file

30
31 // NewMockReservation creates a new mock instance.
32 > func NewMockReservation(ctrl *gomock.Controller) *MockReservation { reservation_mock.go
33 > mock := &MockReservation{ctrl: ctrl}
34 > mock.recorder = &MockReservationMockRecorder{mock}
35 > return mock
36 > }
37
38 // EXPECT returns an object that allows the caller to indicate expected use.
39 > func (m *MockReservation) EXPECT() *MockReservationMockRecorder { reservation_mock.go
40 > return m.recorder
41 > }
42
43 // Cancel mocks base method.
54
55 // CancelAt mocks base method.
56 > func (m *MockReservation) CancelAt(now time.Time) { reservation_mock.go
57 > m.ctrl.T.Helper()
58 > m.ctrl.Call(m, "CancelAt", now)
59 > }
60
61 // CancelAt indicates an expected call of CancelAt.
62 > func (mr *MockReservationMockRecorder) CancelAt(now any) *gomock.Call { reservation_mock.go
63 > mr.mock.ctrl.T.Helper()
64 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelAt", reflect.TypeOf((*MockReservation)(nil).CancelAt), now)
65 > }
66
67 // Delay mocks base method.
go.temporal.io/server/common/quotas/priority_reservation_impl.go 11 covered LOC · 3 ranges

Open complete file

17 decidingReservation Reservation,
18 otherReservations []Reservation,
19 > ) *PriorityReservationImpl { priority_reservation_impl.go
20 > return &PriorityReservationImpl{
21 > decidingReservation: decidingReservation,
22 > otherReservations: otherReservations,
23 > }
24 > }
25
26 // OK returns whether the limiter can provide the requested number of tokens
37 // CancelAt indicates that the reservation holder will not perform the reserved action
38 // and reverses the effects of this Reservation on the rate limit as much as possible
39 > func (r *PriorityReservationImpl) CancelAt(now time.Time) { priority_reservation_impl.go
40 > r.decidingReservation.CancelAt(now)
41 > for _, reservation := range r.otherReservations {
42 > reservation.CancelAt(now) priority_reservation_impl.go
43 > }
44 }
45