-
Notifications
You must be signed in to change notification settings - Fork 4.6k
List actor definitions for workspace #11336
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
Conversation
c383df9
to
bbbed2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Left a non-blocking suggestion about handling MockData
public void testSourceDefinitionGrants() throws IOException { | ||
final UUID workspaceId = MockData.standardWorkspaces().get(0).getWorkspaceId(); | ||
final StandardSourceDefinition grantableDefinition1 = MockData.standardSourceDefinitions().get(1); | ||
final StandardSourceDefinition customDefinition = MockData.standardSourceDefinitions().get(3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I'm trying to think if there's a more elegant/dependable way to set up the public/custom mock data more clearly. Instead of relying on the right definition being at index 3
here, I wonder if we could basically define them as public static fields of MockData.java
so we could access them in tests by doing something like
final StandardSourceDefinition customDefinition = MockData.CUSTOM_SOURCE_DEFINITION;
instead of
final StandardSourceDefinition customDefinition = MockData.standardSourceDefinitions().get(3);
Would need a little bit of rearrangement within MockData.java but might be worth it? Like instead of defining each of the four SourceDefinitions
inside the standardSourceDefinitions()
method, you'd define them as public static
fields and then update that method to just return something like:
return Arrays.asList(SOURCE_DEFINITION_PUBLIC_CATALOG, SOURCE_DEFINITION_PRIVATE_CATALOG, SOURCE_DEFINITION_PRIVATE_CUSTOM);
Or something like that.. there might be a better way that isn't occurring to me right now.
This might be more trouble than it's worth. At the very least, it might make sense to just add something to MockData.java
like:
public SourceDefinition getPrivateCustomSourceDefinition() {
return standardSourceDefinitions().get(3);
}
so that at least we don't need to externally rely on the third index as a magic number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, great idea!
I think I like the idea of making each mock object a public static field but maybe we didn't want the class instantiation to be creating so many objects?
I'll go with creating a descriptively named getter method for each mock.
...ersistence/src/test/java/io/airbyte/config/persistence/ConfigRepositoryE2EReadWriteTest.java
Outdated
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/handlers/DestinationDefinitionsHandler.java
Outdated
Show resolved
Hide resolved
airbyte-server/src/main/java/io/airbyte/server/handlers/SourceDefinitionsHandler.java
Outdated
Show resolved
Hide resolved
throws IOException { | ||
return toDestinationDefinitionReadList(MoreLists.concat( | ||
configRepository.listPublicDestinationDefinitions(false), | ||
configRepository.listGrantedDestinationDefinitions( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to think through what would happen if a definition was somehow in both of these lists, like in a situation where a public: false
definition later became public: true
. But then I realized you're already filtering out public: true
definitions in the granted query, so I think we're covered there!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right exactly! I asked about whether we should clean up old grants when I first thought of this too, but for now I think filtering out public in the granted query should be fine.
don't rely on magic index
What
Part of #9652
Tech Spec
Implements routes to list all actor definitions a given workspace is configured to use. Depends on #11305
Recommended reading order
Easiest to view by commit
User Impact
Doesn't change the behavior of existing routes