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

org.opensearch.plugin:opensearch-dashboards:2.3.0 has issues with opensearch-dashboards unit test #14688

Closed
swaruparameshpajju opened this issue Jul 9, 2024 · 5 comments
Labels
bug Something isn't working Build Build Tasks/Gradle Plugin, groovy scripts, build tools, Javadoc enforcement. Other

Comments

@swaruparameshpajju
Copy link

Describe the bug

[root@b41ffec59270 OpenSearch]# ./gradlew :modules:opensearch-dashboards:test

Configure project :qa:os
Cannot add task 'destructiveDistroTest.docker' as a task with that name already exists.
=======================================
OpenSearch Build Hamster says Hello!
Gradle Version : 7.5.1
OS Info : Linux 5.4.17-2136.308.9.el8uek.x86_64 (amd64)
JDK Version : 17 (Oracle JDK)
JAVA_HOME : /opt/jdk-17.0.8
Random Testing Seed : C3AA90B6B5DFCDE6
In FIPS 140 mode : false
=======================================

Task :modules:opensearch-dashboards:test
OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=warn; support was removed in 17.0

org.opensearch.dashboards.OpenSearchDashboardsPluginTests > classMethod FAILED
java.lang.RuntimeException: can not run opensearch as root
Exception in thread "Thread-4" java.lang.NoClassDefFoundError: Could not initialize class org.opensearch.test.OpenSearchTestCase
at org.opensearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:124)
at org.opensearch.bootstrap.BootstrapForTesting.(BootstrapForTesting.java:105)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.opensearch.test.OpenSearchTestCase.(OpenSearchTestCase.java:257)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:623)
Suppressed: java.lang.IllegalStateException: No context information for thread: Thread[id=32, name=Thread-4, state=RUNNABLE, group=TGRP-OpenSearchDashboardsPluginTests]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @afterclass boundary (for example, static test class initializers are not permitted to access random contexts).
at com.carrotsearch.randomizedtesting.RandomizedContext.context(RandomizedContext.java:249)
at com.carrotsearch.randomizedtesting.RandomizedContext.current(RandomizedContext.java:134)
at com.carrotsearch.randomizedtesting.RandomizedRunner.augmentStackTrace(RandomizedRunner.java:1885)
at com.carrotsearch.randomizedtesting.RunnerThreadGroup.uncaughtException(RunnerThreadGroup.java:20)
at java.base/java.lang.Thread.dispatchUncaughtException(Thread.java:2008)

Suite: Test class org.opensearch.dashboards.OpenSearchDashboardsPluginTests
2> java.lang.RuntimeException: can not run opensearch as root
at org.opensearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:124)
at org.opensearch.bootstrap.BootstrapForTesting.(BootstrapForTesting.java:105)
at org.opensearch.test.OpenSearchTestCase.(OpenSearchTestCase.java:257)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:623)
OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=warn; support was removed in 17.0

org.opensearch.dashboards.OpenSearchDashboardsPluginTests > classMethod FAILED
java.lang.RuntimeException: can not run opensearch as root
at org.opensearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:124)
at org.opensearch.bootstrap.BootstrapForTesting.(BootstrapForTesting.java:105)
at org.opensearch.test.OpenSearchTestCase.(OpenSearchTestCase.java:257)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:623)

Suite: Test class org.opensearch.dashboards.OpenSearchDashboardsPluginTests
2> java.lang.RuntimeException: can not run opensearch as root
at org.opensearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:124)
at org.opensearch.bootstrap.BootstrapForTesting.(BootstrapForTesting.java:105)
at org.opensearch.test.OpenSearchTestCase.(OpenSearchTestCase.java:257)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:623)
Exception in thread "Thread-4" java.lang.NoClassDefFoundError: Could not initialize class org.opensearch.test.OpenSearchTestCase
at java.base/java.lang.Thread.run(Thread.java:833)
Suppressed: java.lang.IllegalStateException: No context information for thread: Thread[id=32, name=Thread-4, state=RUNNABLE, group=TGRP-OpenSearchDashboardsPluginTests]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @afterclass boundary (for example, static test class initializers are not permitted to access random contexts).
at com.carrotsearch.randomizedtesting.RandomizedContext.context(RandomizedContext.java:249)
at com.carrotsearch.randomizedtesting.RandomizedContext.current(RandomizedContext.java:134)
at com.carrotsearch.randomizedtesting.RandomizedRunner.augmentStackTrace(RandomizedRunner.java:1885)
at com.carrotsearch.randomizedtesting.RunnerThreadGroup.uncaughtException(RunnerThreadGroup.java:20)
at java.base/java.lang.Thread.dispatchUncaughtException(Thread.java:2008)
OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=warn; support was removed in 17.0

org.opensearch.dashboards.OpenSearchDashboardsPluginTests > classMethod FAILED
java.lang.RuntimeException: can not run opensearch as root
at org.opensearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:124)
at org.opensearch.bootstrap.BootstrapForTesting.(BootstrapForTesting.java:105)
at org.opensearch.test.OpenSearchTestCase.(OpenSearchTestCase.java:257)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:623)

Suite: Test class org.opensearch.dashboards.OpenSearchDashboardsPluginTests
2> java.lang.RuntimeException: can not run opensearch as root
at org.opensearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:124)
at org.opensearch.bootstrap.BootstrapForTesting.(BootstrapForTesting.java:105)
at org.opensearch.test.OpenSearchTestCase.(OpenSearchTestCase.java:257)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:623)
Exception in thread "Thread-4" java.lang.NoClassDefFoundError: Could not initialize class org.opensearch.test.OpenSearchTestCase
at java.base/java.lang.Thread.run(Thread.java:833)
Suppressed: java.lang.IllegalStateException: No context information for thread: Thread[id=32, name=Thread-4, state=RUNNABLE, group=TGRP-OpenSearchDashboardsPluginTests]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @afterclass boundary (for example, static test class initializers are not permitted to access random contexts).
at com.carrotsearch.randomizedtesting.RandomizedContext.context(RandomizedContext.java:249)
at com.carrotsearch.randomizedtesting.RandomizedContext.current(RandomizedContext.java:134)
at com.carrotsearch.randomizedtesting.RandomizedRunner.augmentStackTrace(RandomizedRunner.java:1885)
at com.carrotsearch.randomizedtesting.RunnerThreadGroup.uncaughtException(RunnerThreadGroup.java:20)
at java.base/java.lang.Thread.dispatchUncaughtException(Thread.java:2008)
OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=warn; support was removed in 17.0
Exception in thread "Thread-4" java.lang.NoClassDefFoundError: Could not initialize class org.opensearch.test.OpenSearchTestCase
at java.base/java.lang.Thread.run(Thread.java:833)
Suppressed: java.lang.IllegalStateException: No context information for thread: Thread[id=32, name=Thread-4, state=RUNNABLE, group=TGRP-OpenSearchDashboardsPluginTests]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @afterclass boundary (for example, static test class initializers are not permitted to access random contexts).
at com.carrotsearch.randomizedtesting.RandomizedContext.context(RandomizedContext.java:249)
at com.carrotsearch.randomizedtesting.RandomizedContext.current(RandomizedContext.java:134)
at com.carrotsearch.randomizedtesting.RandomizedRunner.augmentStackTrace(RandomizedRunner.java:1885)
at com.carrotsearch.randomizedtesting.RunnerThreadGroup.uncaughtException(RunnerThreadGroup.java:20)
at java.base/java.lang.Thread.dispatchUncaughtException(Thread.java:2008)

org.opensearch.dashboards.OpenSearchDashboardsPluginTests > classMethod FAILED
java.lang.RuntimeException: can not run opensearch as root
at org.opensearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:124)
at org.opensearch.bootstrap.BootstrapForTesting.(BootstrapForTesting.java:105)
at org.opensearch.test.OpenSearchTestCase.(OpenSearchTestCase.java:257)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:623)

Suite: Test class org.opensearch.dashboards.OpenSearchDashboardsPluginTests
2> java.lang.RuntimeException: can not run opensearch as root
at org.opensearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:124)
at org.opensearch.bootstrap.BootstrapForTesting.(BootstrapForTesting.java:105)
at org.opensearch.test.OpenSearchTestCase.(OpenSearchTestCase.java:257)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:623)

Tests with failures:

  • org.opensearch.dashboards.OpenSearchDashboardsPluginTests.classMethod

4 tests completed, 4 failed

Task :modules:opensearch-dashboards:test FAILED

FAILURE: Build failed with an exception.

Related component

Other

To Reproduce

Execution failed for task ':modules:opensearch-dashboards:test'.

Expected behavior

Execution failed for task ':modules:opensearch-dashboards:test'.

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@swaruparameshpajju swaruparameshpajju added bug Something isn't working untriaged labels Jul 9, 2024
@github-actions github-actions bot added the Other label Jul 9, 2024
@dblock
Copy link
Member

dblock commented Jul 9, 2024

The error says java.lang.RuntimeException: can not run opensearch as root, does not running as root work?

@swaruparameshpajju
Copy link
Author

Before getting the above error noticed this output
[10 04:27:06.103] | Cannot add task 'destructiveDistroTest.docker' as a task with that name already exists.
[10 04:27:13.302] | =======================================
[10 04:27:13.302] | OpenSearch Build Hamster says Hello!
[10 04:27:13.302] | Gradle Version : 7.5.1
[10 04:27:13.302] | OS Info : Linux 5.4.17-2136.308.9.el8uek.x86_64 (amd64)
[10 04:27:13.303] | JDK Version : 17 (Oracle JDK)
[10 04:27:13.303] | JAVA_HOME : /opt/jdk-17.0.8
[10 04:27:13.303] | Random Testing Seed : AA17E5D2962EE45F
[10 04:27:13.303] | In FIPS 140 mode : false
[10 04:27:13.303] | =======================================
[10 04:27:13.303] |
[10 04:27:13.303] | FAILURE: Build failed with an exception.
[10 04:27:13.303] |
[10 04:27:13.303] | * What went wrong:
[10 04:27:13.304] | Docker (checked [/usr/bin/docker, /usr/local/bin/docker]) is required to run the following tasks:
[10 04:27:13.304] | :distribution:docker:buildArm64DockerImage
[10 04:27:13.304] | :distribution:docker:buildDockerImage
[10 04:27:13.304] | you can address this by attending to the reported issue, or removing the offending tasks from being executed.
[10 04:27:13.304] |
[10 04:27:13.304] | * Try:
[10 04:27:13.304] | > Run with --info or --debug option to get more log output.
[10 04:27:13.305] |
[10 04:27:13.305] | * Exception is:
[10 04:27:13.305] | org.gradle.api.GradleException: Docker (checked [/usr/bin/docker, /usr/local/bin/docker]) is required to run the following tasks:
[10 04:27:13.305] | :distribution:docker:buildArm64DockerImage
[10 04:27:13.305] | :distribution:docker:buildDockerImage
[10 04:27:13.305] | you can address this by attending to the reported issue, or removing the offending tasks from being executed.
[10 04:27:13.305] | at org.opensearch.gradle.docker.DockerSupportService.throwDockerRequiredException(DockerSupportService.java:303)
[10 04:27:13.305] | at org.opensearch.gradle.docker.DockerSupportService.throwDockerRequiredException(DockerSupportService.java:299)
[10 04:27:13.306] | at org.opensearch.gradle.docker.DockerSupportService.failIfDockerUnavailable(DockerSupportService.java:170)
[10 04:27:13.306] | at org.opensearch.gradle.docker.DockerSupportPlugin.lambda$apply$3(DockerSupportPlugin.java:76)
[10 04:27:13.306] | at jdk.internal.reflect.GeneratedMethodAccessor690.invoke(Unknown Source)
[10 04:27:13.306] | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[10 04:27:13.306] | at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingInvocationHandler$1.lambda$run$0(DefaultListenerBuildOperationDecorator.java:255)
[10 04:27:13.306] | at org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication.reapply(DefaultUserCodeApplicationContext.java:98)
[10 04:27:13.306] | at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingInvocationHandler$1.run(DefaultListenerBuildOperationDecorator.java:253)
[10 04:27:13.306] | at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
[10 04:27:13.306] | at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
[10 04:27:13.306] | at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
[10 04:27:13.306] | at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
[10 04:27:13.307] | at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
[10 04:27:13.307] | at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
[10 04:27:13.307] | at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
[10 04:27:13.307] | at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
[10 04:27:13.307] | at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingInvocationHandler.invoke(DefaultListenerBuildOperationDecorator.java:250)
[10 04:27:13.307] | at jdk.proxy1/jdk.proxy1.$Proxy79.graphPopulated(Unknown Source)
[10 04:27:13.307] | at jdk.internal.reflect.GeneratedMethodAccessor690.invoke(Unknown Source)
[10 04:27:13.307] | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[10 04:27:13.307] | at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
[10 04:27:13.307] | at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
[10 04:27:13.307] | at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:43)
[10 04:27:13.307] | at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:245)
[10 04:27:13.307] | at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:157)
[10 04:27:13.308] | at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:61)
[10 04:27:13.308] | at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:346)
[10 04:27:13.308] | at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:249)
[10 04:27:13.308] | at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:141)
[10 04:27:13.308] | at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
[10 04:27:13.308] | at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
[10 04:27:13.308] | at jdk.proxy1/jdk.proxy1.$Proxy79.graphPopulated(Unknown Source)
[10 04:27:13.308] | at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$NotifyTaskGraphWhenReady.run(DefaultTaskExecutionGraph.java:371)

@peternied peternied added Build Build Tasks/Gradle Plugin, groovy scripts, build tools, Javadoc enforcement. and removed untriaged labels Jul 10, 2024
@peternied
Copy link
Member

[Triage - attendees 1 2 3 4]
@swaruparameshpajju Thanks for filing this issue, it looks like this is due to trying to run tasks without docker installed:

[10 04:27:13.303] | * What went wrong:
[10 04:27:13.304] | Docker (checked [/usr/bin/docker, /usr/local/bin/docker]) is required to run the following tasks:
[10 04:27:13.304] | :distribution:docker:buildArm64DockerImage
[10 04:27:13.304] | :distribution:docker:buildDockerImage
[10 04:27:13.304] | you can address this by attending to the reported issue, or removing the offending tasks from being executed.
[10 04:27:13.304] |

@swaruparameshpajju
Copy link
Author

can u give me how to explicitly remove the task which is not required to execute. currently iam running using the command
[root@b41ffec59270 OpenSearch]# ./gradlew :modules:opensearch-dashboards:test
after git clone to repository

@dblock
Copy link
Member

dblock commented Jul 12, 2024

@swaruparameshpajju i think the public slack #dev channel is better suited for questions like these, give it a try?

https://opensearch.org/slack.html

Closing this for now since it doesn't look like a bug in the scripts.

@dblock dblock closed this as completed Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Build Build Tasks/Gradle Plugin, groovy scripts, build tools, Javadoc enforcement. Other
Projects
None yet
Development

No branches or pull requests

3 participants