Skip to content

Commit 52d5522

Browse files
task(Enable OS Test) Refs:#35131 (#35133)
## Summary Registers `OpenSearchUpgradeSuite` as a dedicated CI test matrix entry so it runs automatically with the OpenSearch 3.x upgrade container activated. Also includes minor code-quality cleanup in `ESContentletAPIImpl`. This is the CI companion to #35130, which contains the actual test suite implementation. ## Changes **CI — `.github/test-matrix.yml`** - Added `Integration Tests - OpenSearch Upgrade Suite` suite entry under `integration` - Overrides `base_maven_args` with `-Dopensearch.upgrade.test=true`, which activates the `opensearch-upgrade` Maven profile — that profile starts the OpenSearch 3.x Docker container on port 9201 and restricts Failsafe to run only `OpenSearchUpgradeSuite` - Fixed a trailing whitespace in the existing `base_maven_args` block **Backend — `ESContentletAPIImpl`** - `categories.size() < 1` → `categories.isEmpty()` - `StringBuffer` → `StringBuilder` (non-synchronized context) - String concatenation inside loop → `StringBuilder.append()` chain ## Testing The suite itself (`OpenSearchUpgradeSuite.java` and its member tests) lives in the companion PR #35130 and must be merged before this CI entry is exercisable end-to-end. To verify the matrix entry locally: ```bash # Requires the opensearch-upgrade profile in dotcms-integration/pom.xml ./mvnw verify -pl :dotcms-integration \ -Dcoreit.test.skip=false \ -Dopensearch.upgrade.test=true ``` The profile starts an OpenSearch 3.x container on port 9201 and limits Failsafe to `OpenSearchUpgradeSuite`. ## Breaking Changes **None.** This PR fixes: #35131
1 parent 0dfcd6e commit 52d5522

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

.github/test-matrix.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test_types:
5959
needs_node: false
6060
# Base command for all integration tests
6161
base_maven_args: >-
62-
verify -Dit.test.forkcount=1 -pl :dotcms-integration
62+
verify -Dit.test.forkcount=1 -pl :dotcms-integration
6363
-Dcoreit.test.skip=false
6464
suites:
6565
- name: "Integration Tests - MainSuite 1a"
@@ -80,6 +80,16 @@ test_types:
8080
- name: "Integration Tests - Junit5 Suite 1"
8181
test_class: "Junit5Suite1"
8282
stage_name: "IT Tests Junit5Suite1"
83+
- name: "Integration Tests - OpenSearch Upgrade Suite"
84+
test_class: "OpenSearchUpgradeSuite"
85+
stage_name: "IT Tests OpenSearch Upgrade Suite"
86+
# Override base_maven_args to activate the opensearch-upgrade Maven profile,
87+
# which starts the opensearch-upgrade Docker container and restricts Failsafe
88+
# to only run OpenSearchUpgradeSuite (see dotcms-integration/pom.xml:opensearch-upgrade)
89+
base_maven_args: >-
90+
verify -Dit.test.forkcount=1 -pl :dotcms-integration
91+
-Dcoreit.test.skip=false
92+
-Dopensearch.upgrade.test=true
8393
8494
postman:
8595
condition_input: postman

dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7540,21 +7540,21 @@ public List<Contentlet> find(Category category, long languageId, boolean live, S
75407540
public List<Contentlet> find(List<Category> categories, long languageId, boolean live,
75417541
String orderBy, User user, boolean respectFrontendRoles)
75427542
throws DotDataException, DotContentletStateException, DotSecurityException {
7543-
if (categories == null || categories.size() < 1) {
7543+
if (categories == null || categories.isEmpty()) {
75447544
return new ArrayList<>();
75457545
}
7546-
StringBuffer buffy = new StringBuffer();
7546+
StringBuilder buffy = new StringBuilder();
75477547
buffy.append("+type:content +deleted:false");
75487548
if (live) {
75497549
buffy.append(" +live:true");
75507550
} else {
75517551
buffy.append(" +working:true");
75527552
}
75537553
if (languageId > 0) {
7554-
buffy.append(" +languageId:" + languageId);
7554+
buffy.append(" +languageId:").append(languageId);
75557555
}
75567556
for (Category category : categories) {
7557-
buffy.append(" +c" + category.getInode() + "c:on");
7557+
buffy.append(" +c").append(category.getInode()).append("c:on");
75587558
}
75597559
try {
75607560
return search(buffy.toString(), 0, -1, orderBy, user, respectFrontendRoles);

0 commit comments

Comments
 (0)