[#9009]improvement(lance-rest-server): add ITs for LRS namespace operations#9008
Conversation
| AuxiliaryServiceManager.GRAVITINO_AUX_SERVICE_PREFIX | ||
| + AuxiliaryServiceManager.AUX_SERVICE_NAMES); | ||
| if (value != null && !value.isEmpty()) { | ||
| List<String> serviceNames = COMMA.splitToList(value); |
There was a problem hiding this comment.
Will this splitToList also do the trim to avoid some invisible characters like white space?
There was a problem hiding this comment.
yes. Here is the definition of COMMA:
private static final Splitter COMMA = Splitter.on(",").omitEmptyStrings().trimResults();| updatedServiceNames.add(serviceName); | ||
| } | ||
| } | ||
| String updatedValue = String.join(",", updatedServiceNames); |
There was a problem hiding this comment.
If the updatedServiceNames is empty, shall we remove the config?
| throws IOException { | ||
| if (context.ignoreLanceAuxRestService) { | ||
| return new HashMap<>(); | ||
| } |
There was a problem hiding this comment.
You can use Collections.emptyMap().
| customConfigs.put(LANCE_CONFIG_PREFIX + NAMESPACE_BACKEND_URI.getKey(), gravitinoUri); | ||
|
|
||
| String metalakeName = GravitinoITUtils.genRandomName("LanceRESTService_metalake"); | ||
| customConfigs.put(LANCE_CONFIG_PREFIX + METALAKE_NAME.getKey(), metalakeName); |
There was a problem hiding this comment.
Shall we create the metalake here before using Lance namespace server?
There was a problem hiding this comment.
My thought is that the test class can use getLanceRESTServerMetalakeName() in BaseIT to create the metalake before the test and perform cleanup afterward. If we create the metalake here, it will be difficult to clean up.
| .filter(e -> !e.getKey().equalsIgnoreCase(Catalog.PROPERTY_IN_USE)) | ||
| .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); | ||
| } | ||
|
|
There was a problem hiding this comment.
It's used to remove the in-use property from the old catalog when creating a catalog namespace with overwrite mode.
Because we use removeOldCatalogProperty and setNewCatalogProperty to achieve this, the in-use property in the catalog is reserved and cannot be used in removePropertyChange.
| Assertions.assertEquals( | ||
| IllegalArgumentException.class.getSimpleName(), | ||
| exception.getErrorResponse().get().getType()); | ||
| } |
There was a problem hiding this comment.
Can you add more tests like namespace not exist scenario here?
|
@jerryshao all comments resolved, could you plz help to review again? thx! |
| miniGravitino.start(); | ||
| serverConfig = miniGravitino.getServerConfig(); | ||
| } else { | ||
| if (!ignoreLanceAuxRestService) { |
There was a problem hiding this comment.
Why can't we move the code ignoreLanceAuxRestService and ignoreRestAuxRestService to L346 or before, I noticed that the same logic is there.
| public void startIntegrationTest() throws Exception { | ||
| super.ignoreLanceAuxRestService = false; | ||
| super.startIntegrationTest(); | ||
| this.metalake = createMetalake(getLanceRESTServerMetalakeName()); |
There was a problem hiding this comment.
Why don't we set a constant name before running Lance rest server?
public void startIntegrationTest() throws Exception {
customConfigs.put("gravitino.lance-rest.gravitino.metalake-name", METALAKE_NAME);
super.startIntegrationTest();
}There was a problem hiding this comment.
I think BaseIT should manage the configuration instead of scattering it everywhere.
There was a problem hiding this comment.
BaseIT manages common configurations, and subclasses can adjust them according to the detailed test requirement. Please note SparkIT and FlinkIT, they all make some customization on startIntegrationTest.
I don't think let BaseIT choose the matelake name is good idea.
There was a problem hiding this comment.
For the current implementation, when developers want to enable the LRS in IT, they just need to extend BaseIT and set ignoreLanceAuxRestService = false before tests. They don't need to care about customConfigs, so I prefer to keep the current implementation.
BTW, the automatically generated metalake name is random. Users can also retrieve it using the getLanceRESTServerMetalakeName() method. I don't see a use case that requires specifying a metalake name.
There was a problem hiding this comment.
This isn't a blocker. If you only have this one comment, let's get the ball rolling and merge this. You can address it in a separate PR if needed. WDYT? @jerryshao
There was a problem hiding this comment.
If you insist that They don't need to care about customConfigs and ignore the makelake name, I have no more comment here.
You can think, why don't IcebergITs and FlinkITs also add some specific configuration and functions to the BaseITs?
I don't see a use case that requires specifying a metalake name.
That is not the core point; what matters is that it's the responsibility of the subclass of BaseIT to choose and create makelake.
| @AfterEach | ||
| public void clearMetalake() { | ||
| Arrays.stream(metalake.listCatalogs()).forEach(c -> metalake.dropCatalog(c, true)); | ||
| tempDir.toFile().deleteOnExit(); |
There was a problem hiding this comment.
You have done it in L82, it seems that this is unnecessary.
There was a problem hiding this comment.
ok. keep in afterAll only
|
LGTM |
fc0f617
into
apache:branch-lance-namepspace-dev
…e operations (apache#9008) ### What changes were proposed in this pull request? add ITs for LRS namespace operations ### Why are the changes needed? Fix: apache#9009 ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? CI pass
…e operations (apache#9008) add ITs for LRS namespace operations Fix: apache#9009 no CI pass
…e operations (apache#9008) add ITs for LRS namespace operations Fix: apache#9009 no CI pass
What changes were proposed in this pull request?
add ITs for LRS namespace operations
Why are the changes needed?
Fix: #9009
Does this PR introduce any user-facing change?
no
How was this patch tested?
CI pass