Skip to content

Commit 33ef00d

Browse files
committed
Fix update of got
1 parent f3e72ea commit 33ef00d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

coderd/database/dbfake/databasefake.go

+8
Original file line numberDiff line numberDiff line change
@@ -2751,6 +2751,10 @@ func (q *fakeQuerier) InsertAPIKey(_ context.Context, arg database.InsertAPIKeyP
27512751
}
27522752

27532753
func (q *fakeQuerier) UpdateWorkspaceAgentMetadata(_ context.Context, arg database.UpdateWorkspaceAgentMetadataParams) error {
2754+
if err := validateDatabaseType(arg); err != nil {
2755+
return err
2756+
}
2757+
27542758
q.mutex.Lock()
27552759
defer q.mutex.Unlock()
27562760

@@ -2774,6 +2778,10 @@ func (q *fakeQuerier) UpdateWorkspaceAgentMetadata(_ context.Context, arg databa
27742778
}
27752779

27762780
func (q *fakeQuerier) InsertWorkspaceAgentMetadata(_ context.Context, arg database.InsertWorkspaceAgentMetadataParams) error {
2781+
if err := validateDatabaseType(arg); err != nil {
2782+
return err
2783+
}
2784+
27772785
q.mutex.Lock()
27782786
defer q.mutex.Unlock()
27792787

coderd/workspaceagents_test.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,13 @@ func TestWorkspaceAgent_Metadata(t *testing.T) {
12941294
// We can't trust the order of the updates due to timers and debounces,
12951295
// so let's check a few times once more.
12961296
for i := 0; i < 2 && (want.Value != got.Result.Value || want.Error != got.Result.Error); i++ {
1297-
recvUpdate()
1297+
update = recvUpdate()
1298+
for _, m := range update {
1299+
if m.Description.Key == got.Description.Key {
1300+
got = m
1301+
break
1302+
}
1303+
}
12981304
}
12991305
ok1 := assert.Equal(t, want.Value, got.Result.Value)
13001306
ok2 := assert.Equal(t, want.Error, got.Result.Error)

0 commit comments

Comments
 (0)