Skip to content

[#9009]improvement(lance-rest-server): add ITs for LRS namespace operations#9008

Merged
jerryshao merged 8 commits intoapache:branch-lance-namepspace-devfrom
mchades:add-tests
Nov 4, 2025
Merged

[#9009]improvement(lance-rest-server): add ITs for LRS namespace operations#9008
jerryshao merged 8 commits intoapache:branch-lance-namepspace-devfrom
mchades:add-tests

Conversation

@mchades
Copy link
Copy Markdown
Contributor

@mchades mchades commented Nov 3, 2025

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

@mchades mchades changed the title improvement(lance-rest-server): add ITs for LRS namespace operations [#9009]improvement(lance-rest-server): add ITs for LRS namespace operations Nov 3, 2025
@mchades mchades requested review from jerryshao and yuqi1129 November 3, 2025 12:07
@mchades mchades marked this pull request as ready for review November 3, 2025 12:07
AuxiliaryServiceManager.GRAVITINO_AUX_SERVICE_PREFIX
+ AuxiliaryServiceManager.AUX_SERVICE_NAMES);
if (value != null && !value.isEmpty()) {
List<String> serviceNames = COMMA.splitToList(value);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this splitToList also do the trim to avoid some invisible characters like white space?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. Here is the definition of COMMA:

private static final Splitter COMMA = Splitter.on(",").omitEmptyStrings().trimResults();

updatedServiceNames.add(serviceName);
}
}
String updatedValue = String.join(",", updatedServiceNames);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the updatedServiceNames is empty, shall we remove the config?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, fixed

throws IOException {
if (context.ignoreLanceAuxRestService) {
return new HashMap<>();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we create the metalake here before using Lance namespace server?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we remove this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add more tests like namespace not exist scenario here?

@mchades mchades requested a review from jerryshao November 4, 2025 04:56
@mchades
Copy link
Copy Markdown
Contributor Author

mchades commented Nov 4, 2025

@jerryshao all comments resolved, could you plz help to review again? thx!

miniGravitino.start();
serverConfig = miniGravitino.getServerConfig();
} else {
if (!ignoreLanceAuxRestService) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we move the code ignoreLanceAuxRestService and ignoreRestAuxRestService to L346 or before, I noticed that the same logic is there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

public void startIntegrationTest() throws Exception {
super.ignoreLanceAuxRestService = false;
super.startIntegrationTest();
this.metalake = createMetalake(getLanceRESTServerMetalakeName());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
  }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think BaseIT should manage the configuration instead of scattering it everywhere.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuqi1129 you can update based on this PR.

@AfterEach
public void clearMetalake() {
Arrays.stream(metalake.listCatalogs()).forEach(c -> metalake.dropCatalog(c, true));
tempDir.toFile().deleteOnExit();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have done it in L82, it seems that this is unnecessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. keep in afterAll only

@mchades mchades requested a review from yuqi1129 November 4, 2025 08:21
@yuqi1129
Copy link
Copy Markdown
Contributor

yuqi1129 commented Nov 4, 2025

LGTM

@jerryshao jerryshao merged commit fc0f617 into apache:branch-lance-namepspace-dev Nov 4, 2025
26 checks passed
@mchades mchades deleted the add-tests branch November 4, 2025 11:16
@mchades mchades self-assigned this Nov 4, 2025
jerryshao pushed a commit to jerryshao/gravitino that referenced this pull request Nov 11, 2025
…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
youngyjd pushed a commit to youngyjd/gravitino that referenced this pull request Nov 21, 2025
…e operations (apache#9008)

add ITs for LRS namespace operations

Fix: apache#9009

no

CI pass
youngyjd pushed a commit to youngyjd/gravitino that referenced this pull request Nov 21, 2025
…e operations (apache#9008)

add ITs for LRS namespace operations

Fix: apache#9009

no

CI pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants