Skip to content
Prev Previous commit
Next Next commit
fix
  • Loading branch information
f0ssel committed Sep 16, 2024
commit f7f6ab17c4dff2ca8ebd7d8e2a4f269f74bace55
13 changes: 13 additions & 0 deletions coderd/database/dbauthz/dbauthz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,19 @@ func (s *MethodTestSuite) TestProvisionerKeys() {
}
check.Args(org.ID).Asserts(pk, policy.ActionRead).Returns(pks)
}))
s.Run("ListProvisionerKeysByOrganizationExcludeReserved", s.Subtest(func(db database.Store, check *expects) {
org := dbgen.Organization(s.T(), db, database.Organization{})
pk := dbgen.ProvisionerKey(s.T(), db, database.ProvisionerKey{OrganizationID: org.ID})
pks := []database.ProvisionerKey{
{
ID: pk.ID,
CreatedAt: pk.CreatedAt,
OrganizationID: pk.OrganizationID,
Name: pk.Name,
},
}
check.Args(org.ID).Asserts(pk, policy.ActionRead).Returns(pks)
}))
s.Run("DeleteProvisionerKey", s.Subtest(func(db database.Store, check *expects) {
org := dbgen.Organization(s.T(), db, database.Organization{})
pk := dbgen.ProvisionerKey(s.T(), db, database.ProvisionerKey{OrganizationID: org.ID})
Expand Down
2 changes: 1 addition & 1 deletion coderd/database/dbmem/dbmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -7618,7 +7618,7 @@ func (q *FakeQuerier) ListProvisionerKeysByOrganization(_ context.Context, organ
return keys, nil
}

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

Expand Down
2 changes: 1 addition & 1 deletion enterprise/coderd/provisionerkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (api *API) provisionerKeyDaemons(rw http.ResponseWriter, r *http.Request) {
// provisionerdserver.DefaultHeartbeatInterval*3 matches the healthcheck report staleInterval.
recentDaemons := db2sdk.RecentProvisionerDaemons(time.Now(), provisionerdserver.DefaultHeartbeatInterval*3, daemons)

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