Skip to content

Add systemd integ tests to run with docker#17308

Closed
RajatGupta02 wants to merge 4 commits into
opensearch-project:mainfrom
RajatGupta02:systemd-integ
Closed

Add systemd integ tests to run with docker#17308
RajatGupta02 wants to merge 4 commits into
opensearch-project:mainfrom
RajatGupta02:systemd-integ

Conversation

@RajatGupta02
Copy link
Copy Markdown
Contributor

Description

This PR adds integration tests for the systemd unit file that ships with the opensearch distribution. The tests run on the systemd service that runs within a docker container. The tests have been written to run with the systemd unit file that is expected to release with version 3.0 .

Supporting References

Related PR: #17107

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Rajat Gupta added 3 commits February 10, 2025 02:27
Signed-off-by: Rajat Gupta <gptrajat@amazon.com>
Signed-off-by: Rajat Gupta <gptrajat@amazon.com>
Signed-off-by: Rajat Gupta <gptrajat@amazon.com>
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for e9c7531: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Comment thread qa/systemd-test/docker-compose.yml Outdated
container_name: opensearch-systemd-test-container
build:
dockerfile_inline: |
FROM amazonlinux:2023
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.

Could we use cloud vendor neutral image here? We have a large number of distributions here under qa\os folder (many are outdated sadly, may be a good opportunity to fix that)

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.

Sure, does this image quay.io/centos/centos:stream9 work?

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.

Signed-off-by: Rajat Gupta <gptrajat@amazon.com>
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 56c519d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

# install systemd
RUN dnf -y install systemd && dnf clean all
# in practice, you'd COPY in the RPM you want to test right here
RUN dnf -y install https://artifacts.opensearch.org/releases/bundle/opensearch/2.18.0/opensearch-2.18.0-linux-x64.rpm && dnf clean all
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.

the problem with this approach is that we are always testing a fixed & stale version of opensearch and its systemd unit. Unfortunately, I don't have a solution for it. @reta you could something better?

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.

We build RPMs as part of the distributions [1], shouldn't we use those instead?

[1] https://github.com/opensearch-project/OpenSearch/tree/main/distribution/packages/rpm

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.

thanks. that solution looks perfect.

question: the RPM is built once for every major/minor version release cycle? or it gets updated as we merge code in main? or a nightly build?

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.

question: the RPM is built once for every major/minor version release cycle? or it gets updated as we merge code in main? or a nightly build?

It is part of the build: ./gradlew assemble

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.

@peterzhuamazon Could you please suggest a way we can resolve this (i.e. taking the latest distribution and not hardcoding it every time a new version is released?)

Copy link
Copy Markdown
Contributor

@reta reta Feb 19, 2025

Choose a reason for hiding this comment

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

@RajatGupta02 so we build the RPM as part the Gradle build itself, there should be no need to look for the distribution RPMs anywhere outside the local build itself. These tests could be run as part of distribution builds. Take a look on [1] as an inspiration, adds some tests for archive distribution. We could have a test module for packages as well that will use Docker Compose against RPMs

[1] https://github.com/opensearch-project/OpenSearch/tree/main/distribution/archives/integ-test-zip

Copy link
Copy Markdown
Contributor Author

@RajatGupta02 RajatGupta02 Feb 19, 2025

Choose a reason for hiding this comment

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

Actually I had a discussion regarding the same with @peterzhuamazon, since the rpm distribution being locally built with ./gradlew assemble gave errors while installing, to which he explained that there are certain scripts that are added on top of it to make it runnable, and that is done in the opensearch-build repo

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.

Do we need this scripts? If yes, we have to move these test(s) to opensearch-build and make it part of their workflow

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.

@RajatGupta02 yeah, moving it to opensearch-build might make more sense, because in the other PR @peterzhuamazon suggests that the systemd configs are eventually moved into opensearch-build, so ideally we should test against that copy of systemd unit.

but let's evaluate how much is the effort for the move, I know you have limited time and you have already spent a significant time on getting this up and ready in core.

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.

Will have to sync up with @peterzhuamazon to understand how should we integrate new tests within the opensearch-build repo

}

@Test
public void testProcessExit() throws IOException, InterruptedException {
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.

nit: should we name it as testOpensearchProcessCannotExit?

@RajatGupta02
Copy link
Copy Markdown
Contributor Author

Moved to #17410

@RajatGupta02 RajatGupta02 deleted the systemd-integ branch April 30, 2025 07:58
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