Skip to content

chore: convert dbauthz tests to also run with Postgres #15862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add more comments around OverrideSQLFilter
  • Loading branch information
hugodutka committed Jan 8, 2025
commit 76a2e89b92c93b5d405614da5616534f7e05573f
2 changes: 1 addition & 1 deletion coderd/coderdtest/authorize.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ func (d *FakeAuthorizer) AlwaysReturn(err error) *FakeAuthorizer {
return d
}

// OverrideSQLFilter overrides the SQL filter for the FakeAuthorizer.
// OverrideSQLFilter sets the SQL filter that will always be returned by CompileToSQL.
func (d *FakeAuthorizer) OverrideSQLFilter(filter string) *FakeAuthorizer {
d.sqlFilter = filter
return d
Expand Down
1 change: 1 addition & 0 deletions coderd/database/dbauthz/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ func (s *MethodTestSuite) NoActorErrorTest(callMethod func(ctx context.Context)
func (s *MethodTestSuite) NotAuthorizedErrorTest(ctx context.Context, az *coderdtest.FakeAuthorizer, testCase expects, callMethod func(ctx context.Context) ([]reflect.Value, error)) {
s.Run("NotAuthorized", func() {
az.AlwaysReturn(rbac.ForbiddenWithInternal(xerrors.New("Always fail authz"), rbac.Subject{}, "", rbac.Object{}, nil))
// Override the SQL filter to always fail.
az.OverrideSQLFilter("FALSE")

// If we have assertions, that means the method should FAIL
Expand Down