Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit183146e

Browse files
fix: add minor fix to reconciliation loop (#17454)
Follow-up PR to#17261I noticed that 1 metrics-related test fails in `dk/prebuilds` aftermerging my PR into `dk/prebuilds`.
1 parent144c60d commit183146e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

‎coderd/prebuilds/preset_snapshot.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ func (p PresetSnapshot) CalculateState() *ReconciliationState {
9191
extraneousint32
9292
)
9393

94+
// #nosec G115 - Safe conversion as p.Running slice length is expected to be within int32 range
95+
actual=int32(len(p.Running))
96+
9497
ifp.isActive() {
95-
// #nosec G115 - Safe conversion as p.Running slice length is expected to be within int32 range
96-
actual=int32(len(p.Running))
9798
desired=p.Preset.DesiredInstances.Int32
9899
eligible=p.countEligible()
99100
extraneous=max(actual-desired,0)

‎coderd/prebuilds/preset_snapshot_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ func TestOutdatedPrebuilds(t *testing.T) {
146146
state:=ps.CalculateState()
147147
actions,err:=ps.CalculateActions(clock,backoffInterval)
148148
require.NoError(t,err)
149-
validateState(t, prebuilds.ReconciliationState{},*state)
149+
validateState(t, prebuilds.ReconciliationState{
150+
Actual:1,
151+
},*state)
150152
validateActions(t, prebuilds.ReconciliationActions{
151153
ActionType:prebuilds.ActionTypeDelete,
152154
DeleteIDs: []uuid.UUID{outdated.prebuiltWorkspaceID},
@@ -208,6 +210,7 @@ func TestDeleteOutdatedPrebuilds(t *testing.T) {
208210
actions,err:=ps.CalculateActions(clock,backoffInterval)
209211
require.NoError(t,err)
210212
validateState(t, prebuilds.ReconciliationState{
213+
Actual:1,
211214
Deleting:1,
212215
},*state)
213216

@@ -530,7 +533,9 @@ func TestDeprecated(t *testing.T) {
530533
state:=ps.CalculateState()
531534
actions,err:=ps.CalculateActions(clock,backoffInterval)
532535
require.NoError(t,err)
533-
validateState(t, prebuilds.ReconciliationState{},*state)
536+
validateState(t, prebuilds.ReconciliationState{
537+
Actual:1,
538+
},*state)
534539
validateActions(t, prebuilds.ReconciliationActions{
535540
ActionType:prebuilds.ActionTypeDelete,
536541
DeleteIDs: []uuid.UUID{current.prebuiltWorkspaceID},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp