Skip to content

[TASK] Integration test coverage for ContentFactoryIndexOperationsOS #35278

@fabrizzio-dotCMS

Description

@fabrizzio-dotCMS

Description

ContentFactoryIndexOperationsOS is the OS delegate inside ESContentFactoryImpl:

```java
private final ContentFactoryIndexOperations indexOperationsES;
private final ContentFactoryIndexOperations indexOperationsOS; // ← no coverage
```

The ES counterpart (ContentFactoryIndexOperationsES) has coverage through the existing ESContentFactoryImplTest. The OS implementation has zero integration test coverage.

A parallel test class — ContentFactoryIndexOperationsOSIntegrationTest — must be created following the same structure as the already-existing ContentletIndexOperationsOSIntegrationTest (which covers ContentletIndexOperationsOS against a live OS 3.x container).

Acceptance Criteria

  • A new integration test class ContentFactoryIndexOperationsOSIntegrationTest is created under dotcms-integration/.../content/index/opensearch/.
  • The class is registered in OpenSearchUpgradeSuite (only suite with a live OS 3.x instance).
  • All public methods of ContentFactoryIndexOperations that are implemented by the OS delegate are covered:
    • createBulkRequest() — returns a non-null, empty request
    • addIndexOp() / addDeleteOp() — increase bulk request size
    • putToIndex() — document is visible after refresh; empty batch is a no-op
    • createBulkProcessor() — returns non-null processor; flush on close persists the document
    • addIndexOpToProcessor() / addDeleteOpToProcessor() — document appears / disappears after flush
    • getIndexDocumentCount() — returns 0 for an empty index, correct count after writes
  • Prerequisite validation (spike): confirm that OpenSearchUpgradeSuite is the only suite that provides a live OS instance, or identify an alternative suite where these tests could also run. Document findings in the PR description.
  • Tests use a RUN_ID-namespaced index to avoid cross-run pollution.
  • @Before / @After lifecycle cleans up test indices.

Additional Context

  • Suite constraint: OpenSearchUpgradeSuite is activated via -Dopensearch.upgrade.test=true (starts opensearch-upgrade Docker container on port 9201).
  • Run command:
    ```
    ./mvnw verify -pl :dotcms-integration -Dcoreit.test.skip=false -Dopensearch.upgrade.test=true
    ```
  • Reference implementations: ContentletIndexOperationsOSIntegrationTest (same package), ESContentFactoryImplTest (ES baseline).
  • Related class: IndexConfigHelper.MigrationPhase (phase logic lives here).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    In Review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions