Skip to content

Commit f7f6ab1

Browse files
committed
fix
1 parent 8283329 commit f7f6ab1

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,6 +2020,19 @@ func (s *MethodTestSuite) TestProvisionerKeys() {
20202020
}
20212021
check.Args(org.ID).Asserts(pk, policy.ActionRead).Returns(pks)
20222022
}))
2023+
s.Run("ListProvisionerKeysByOrganizationExcludeReserved", s.Subtest(func(db database.Store, check *expects) {
2024+
org := dbgen.Organization(s.T(), db, database.Organization{})
2025+
pk := dbgen.ProvisionerKey(s.T(), db, database.ProvisionerKey{OrganizationID: org.ID})
2026+
pks := []database.ProvisionerKey{
2027+
{
2028+
ID: pk.ID,
2029+
CreatedAt: pk.CreatedAt,
2030+
OrganizationID: pk.OrganizationID,
2031+
Name: pk.Name,
2032+
},
2033+
}
2034+
check.Args(org.ID).Asserts(pk, policy.ActionRead).Returns(pks)
2035+
}))
20232036
s.Run("DeleteProvisionerKey", s.Subtest(func(db database.Store, check *expects) {
20242037
org := dbgen.Organization(s.T(), db, database.Organization{})
20252038
pk := dbgen.ProvisionerKey(s.T(), db, database.ProvisionerKey{OrganizationID: org.ID})

coderd/database/dbmem/dbmem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7618,7 +7618,7 @@ func (q *FakeQuerier) ListProvisionerKeysByOrganization(_ context.Context, organ
76187618
return keys, nil
76197619
}
76207620

7621-
func (q *FakeQuerier) ListProvisionerKeysByOrganizationExcludeReserved(ctx context.Context, organizationID uuid.UUID) ([]database.ProvisionerKey, error) {
7621+
func (q *FakeQuerier) ListProvisionerKeysByOrganizationExcludeReserved(_ context.Context, organizationID uuid.UUID) ([]database.ProvisionerKey, error) {
76227622
q.mutex.RLock()
76237623
defer q.mutex.RUnlock()
76247624

enterprise/coderd/provisionerkeys.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (api *API) provisionerKeyDaemons(rw http.ResponseWriter, r *http.Request) {
142142
// provisionerdserver.DefaultHeartbeatInterval*3 matches the healthcheck report staleInterval.
143143
recentDaemons := db2sdk.RecentProvisionerDaemons(time.Now(), provisionerdserver.DefaultHeartbeatInterval*3, daemons)
144144

145-
pkDaemons := make([]codersdk.ProvisionerKeyDaemons, 0, len(sdkKeys))
145+
pkDaemons := []codersdk.ProvisionerKeyDaemons{}
146146
for _, key := range sdkKeys {
147147
// currently we exclude user-auth from this list
148148
if key.ID.String() == codersdk.ProvisionerKeyIDUserAuth {

0 commit comments

Comments
 (0)