Skip to content

Commit 2377d76

Browse files
test: ensure the return value of MockAuditor.Contains is checked (#18319)
It unfortunately doesn't seem possible, even with a custom ruleguard rule, to mark a function as requiring it's return value be used, it looks like you have to go all in on a linter that rejects *any* unused return values.
1 parent dd27a28 commit 2377d76

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

coderd/agentapi/audit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func TestAuditReport(t *testing.T) {
135135
},
136136
})
137137

138-
mAudit.Contains(t, database.AuditLog{
138+
require.True(t, mAudit.Contains(t, database.AuditLog{
139139
Time: dbtime.Time(tt.time).In(time.UTC),
140140
Action: agentProtoConnectionActionToAudit(t, *tt.action),
141141
OrganizationID: workspace.OrganizationID,
@@ -146,7 +146,7 @@ func TestAuditReport(t *testing.T) {
146146
ResourceTarget: agent.Name,
147147
Ip: pqtype.Inet{Valid: true, IPNet: net.IPNet{IP: net.ParseIP(tt.ip), Mask: net.CIDRMask(32, 32)}},
148148
StatusCode: tt.status,
149-
})
149+
}))
150150

151151
// Check some additional fields.
152152
var m map[string]any

coderd/userauth_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,10 +1577,10 @@ func TestUserOIDC(t *testing.T) {
15771577
})
15781578
require.Equal(t, http.StatusOK, resp.StatusCode)
15791579

1580-
auditor.Contains(t, database.AuditLog{
1580+
require.True(t, auditor.Contains(t, database.AuditLog{
15811581
ResourceType: database.ResourceTypeUser,
15821582
AdditionalFields: json.RawMessage(`{"automatic_actor":"coder","automatic_subsystem":"dormancy"}`),
1583-
})
1583+
}))
15841584
me, err := client.User(ctx, "me")
15851585
require.NoError(t, err)
15861586

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy