Skip to content
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

[Do Not Merge] chore: Shadow PR for external contribution #36062 #36532

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,7 @@ public Mono<DatasourceStructure> getStructure(
}
return true;
})
.sort((collectionName1, collectionName2) -> collectionName1.compareToIgnoreCase(collectionName2))
.flatMap(collectionName -> {
final ArrayList<DatasourceStructure.Column> columns = new ArrayList<>();
final ArrayList<DatasourceStructure.Template> templates = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,26 @@ public void testStructure() {
.verifyComplete();
}

@Test
public void testStructure_should_return_collections_in_order() {
DatasourceConfiguration dsConfig = createDatasourceConfiguration();
Mono<DatasourceStructure> structureMono = pluginExecutor
.datasourceCreate(dsConfig)
.flatMap(connection -> pluginExecutor.getStructure(connection, dsConfig, null));

StepVerifier.create(structureMono)
.assertNext(structure -> {
assertNotNull(structure);
assertEquals(3, structure.getTables().size());

// Check that the tables are sorted in ascending order
assertEquals("address", structure.getTables().get(0).getName());
assertEquals("teams", structure.getTables().get(1).getName());
assertEquals("users", structure.getTables().get(2).getName());
})
.verifyComplete();
}

@Test
public void testCountCommand() {
DatasourceConfiguration dsConfig = createDatasourceConfiguration();
Expand Down
Loading