Repository navigation
Register the fake server's permission object types per API - #8042
Draft
janniklasrose wants to merge 2 commits into
Draft
janniklasrose wants to merge 2 commits into
janniklasrose wants to merge 2 commits into
Conversation
The fake permissions API kept one hand-written table of request object types, so adding a permissions object type for an API meant editing a shared file. Each API file in libs/testserver now registers its permission object types from init(), next to its routes and store. Object types whose API the fake server does not model stay registered in permissions.go. A second registration of the same request object type panics. The set of pairs is unchanged. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Contributor
Regression test report ✅Commit: Selected 20 changed tests (limit=20, 99 not selected) 128 tests: regression=2 unreleased=0 coverage=126 failing=0
TestAccept/bundle/resources/grants/model_services/DMS=: branch ✅ | main (3f3ebfd) ❌ | latest (v1.28.0) ❌main (3f3ebfd): latest (v1.28.0): TestAccept/bundle/resources/grants/model_services/DMS=true: branch ✅ | main (3f3ebfd) ❌ | latest (v1.28.0) ❌main (3f3ebfd): latest (v1.28.0): same output as main (3f3ebfd) |
Collaborator
✅ Integration test reportCommit: 9ff2b6e
Top 27 slowest tests (at least 2 minutes):
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
registerPermissionsObjectTypein that file'sinit(), next to its route and store registrations. The hand-written tablerequestObjectTypeToObjectTypeinlibs/testserver/permissions.gois gone.permissions.go, registered there under one comment, because the fake server serves their permissions without modelling the API:authorization,dbsql-dashboards,sql/alertsandsql/queries.TestPermissionsObjectTypesMatchTestServersays where a missing object type is registered.This builds on the combined branch of the per-resource changes, which contains the fake server's per-API registration (#8018) and the test above (#8005).
Why
A bundle resource type declares its permissions object types itself, and
TestPermissionsObjectTypesMatchTestServerfails when the fake server does not know one of them. So a new resource type with a new permissions object type meant editing a shared table in the fake server. Now it means one line in the file of its API.Tests
This pull request and its description were written by Isaac.