Skip to content

ci(native): Add container tests for sidecar#25200

Open
anandamideShakyan wants to merge 21 commits intoprestodb:masterfrom
anandamideShakyan:ci-infrastructure-testing
Open

ci(native): Add container tests for sidecar#25200
anandamideShakyan wants to merge 21 commits intoprestodb:masterfrom
anandamideShakyan:ci-infrastructure-testing

Conversation

@anandamideShakyan
Copy link
Contributor

@anandamideShakyan anandamideShakyan commented May 26, 2025

Description

Implement container based test cases for Java/native clusters.

Test matrix: Native cluster

  1. Coordinator with sidecar running
  • Function analysis works correctly
    • select query with fail function fails (not registered in C++)
    • select query with X function succeeds (X is registered in C++ but not in Java)
      • array_sort example
  • Show functions works correctly
    • Returns functions in the native.default namespace.
  1. Coordinator with no sidecar running
  • Queries pause for a time, and eventually fail after N seconds

Test Matrix :Java cluster

  1. Coordinator with sidecar running
  • Queries fail due to invalid configuration
  1. Coordinator with no sidecar running
  • Function analysis works correctly
    • select query with fail function succeeds
    • select query with X function fails (X is registered in C++ but not in Java)
  • Show functions works correctly
    • Returns functions in the presto.default namespace
  • Show session works correctly
    • Java spilling properties present in session properties

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

If release note is NOT required, use:

== NO RELEASE NOTE ==

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label May 26, 2025
@anandamideShakyan anandamideShakyan force-pushed the ci-infrastructure-testing branch 2 times, most recently from f5f4c2f to 085a9bd Compare June 6, 2025 17:43
@anandamideShakyan anandamideShakyan force-pushed the ci-infrastructure-testing branch from c1de62c to 80e1408 Compare June 11, 2025 07:44
@anandamideShakyan anandamideShakyan force-pushed the ci-infrastructure-testing branch from 80e1408 to 39c9a0c Compare July 3, 2025 14:25
@anandamideShakyan anandamideShakyan changed the title Ci infrastructure testing [native] FusionNext - Infrastructure testing Jul 3, 2025
@anandamideShakyan anandamideShakyan marked this pull request as ready for review July 3, 2025 16:29
@prestodb-ci prestodb-ci requested review from a team, imsayari404 and jp-sivaprasad and removed request for a team July 3, 2025 16:29
Copy link
Contributor

@pdabre12 pdabre12 left a comment

Choose a reason for hiding this comment

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

@anandamideShakyan Thanks for this code, have some initial comments.

@anandamideShakyan anandamideShakyan force-pushed the ci-infrastructure-testing branch 2 times, most recently from 37e938d to c2e1160 Compare July 16, 2025 17:28
@anandamideShakyan anandamideShakyan force-pushed the ci-infrastructure-testing branch from c2e1160 to a0f5fb8 Compare July 23, 2025 15:06
@anandamideShakyan anandamideShakyan force-pushed the ci-infrastructure-testing branch from a0f5fb8 to 46a9607 Compare July 24, 2025 08:42
@tdcmeehan
Copy link
Contributor

@anandamideShakyan I think we can go about it like this:

  1. NodeResourceStatus should make use of the existing ClusterSizeMonitor#hasRequiredCoordinatorSidecars method
  2. After that, you can poll the /v1/info/state endpoint.

CC: @pdabre12 what do you think?

@pdabre12
Copy link
Contributor

@tdcmeehan Great idea !
I think we should be able to use that @anandamideShakyan.

@anandamideShakyan
Copy link
Contributor Author

@pdabre12 @tdcmeehan I added the check for ClusterSizeMonitor.hasRequiredCoordinatorSidecar and setup polling for v1/info/state. The query still fails even after the state is "ACTIVE".

2025-07-28T02:32:02.969-0600 INFO Creating container for image: presto-worker:latest
2025-07-28T02:32:02.995-0600 INFO Container presto-worker:latest is starting: 8c1b550ba200cbc584d3f7295654e259742e7e6ccc78e13f89dc6beaa2755e2a
2025-07-28T02:32:03.110-0600 INFO Container presto-worker:latest started in PT0.141S
2025-07-28T02:32:08.111-0600 INFO Presto UI is accessible at http://localhost:32804
Attempt 1: State = ACTIVE
Coordinator is ACTIVE.
java.sql.SQLException: Query failed (#20250728_083208_00000_8it2y): Failed to get functions from sidecar.
	at com.facebook.presto.jdbc.PrestoResultSet.resultsException(PrestoResultSet.java:1842)
	at com.facebook.presto.jdbc.PrestoResultSet.getColumns(PrestoResultSet.java:1752)
	at com.facebook.presto.jdbc.PrestoResultSet.<init>(PrestoResultSet.java:122)
	at com.facebook.presto.jdbc.PrestoStatement.internalExecute(PrestoStatement.java:273)
	at com.facebook.presto.jdbc.PrestoStatement.execute(PrestoStatement.java:231)
	at com.facebook.presto.jdbc.PrestoStatement.executeQuery(PrestoStatement.java:80)
	at com.facebook.presto.nativeworker.ContainerQueryRunner.execute(ContainerQueryRunner.java:470)
	at com.facebook.presto.tests.AbstractTestQueryFramework.computeActualWithCustomQueryRunner(AbstractTestQueryFramework.java:167)
	at com.facebook.presto.nativeworker.TestPrestoContainerSidecarInfrastructure.TestNativeClusterWithSidecar(TestPrestoContainerSidecarInfrastructure.java:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:135)
	at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:673)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:220)
	at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
	at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:945)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:193)
	at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
	at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.testng.TestRunner.privateRun(TestRunner.java:808)
	at org.testng.TestRunner.run(TestRunner.java:603)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:429)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:423)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:383)
	at org.testng.SuiteRunner.run(SuiteRunner.java:326)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1249)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
	at org.testng.TestNG.runSuites(TestNG.java:1092)
	at org.testng.TestNG.run(TestNG.java:1060)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:65)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)
Caused by: com.facebook.presto.spi.PrestoException: Failed to get functions from sidecar.
	at com.facebook.presto.sidecar.functionNamespace.NativeFunctionDefinitionProvider.getUdfDefinition(NativeFunctionDefinitionProvider.java:69)
	at com.facebook.presto.sidecar.functionNamespace.NativeFunctionNamespaceManager.bootstrapNamespace(NativeFunctionNamespaceManager.java:131)
	at com.google.common.base.Suppliers$ExpiringMemoizingSupplier.get(Suppliers.java:261)
	at com.facebook.presto.sidecar.functionNamespace.NativeFunctionNamespaceManager.listFunctions(NativeFunctionNamespaceManager.java:311)
	at com.facebook.presto.metadata.FunctionAndTypeManager.listFunctions(FunctionAndTypeManager.java:448)
	at com.facebook.presto.sql.rewrite.ShowQueriesRewrite$Visitor.visitShowFunctions(ShowQueriesRewrite.java:716)
	at com.facebook.presto.sql.rewrite.ShowQueriesRewrite$Visitor.visitShowFunctions(ShowQueriesRewrite.java:189)
	at com.facebook.presto.sql.tree.ShowFunctions.accept(ShowFunctions.java:61)
	at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:27)
	at com.facebook.presto.sql.rewrite.ShowQueriesRewrite.rewrite(ShowQueriesRewrite.java:186)
	at com.facebook.presto.sql.rewrite.StatementRewrite.rewrite(StatementRewrite.java:60)
	at com.facebook.presto.sql.analyzer.Analyzer.analyzeSemantic(Analyzer.java:116)
	at com.facebook.presto.sql.analyzer.BuiltInQueryAnalyzer.analyze(BuiltInQueryAnalyzer.java:95)
	at com.facebook.presto.execution.SqlQueryExecution.lambda$new$0(SqlQueryExecution.java:218)
	at com.facebook.presto.common.RuntimeStats.recordWallAndCpuTime(RuntimeStats.java:158)
	at com.facebook.presto.execution.SqlQueryExecution.<init>(SqlQueryExecution.java:218)
	at com.facebook.presto.execution.SqlQueryExecution.<init>(SqlQueryExecution.java:111)
	at com.facebook.presto.execution.SqlQueryExecution$SqlQueryExecutionFactory.createQueryExecution(SqlQueryExecution.java:1009)
	at com.facebook.presto.dispatcher.LocalDispatchQueryFactory.lambda$createDispatchQuery$0(LocalDispatchQueryFactory.java:170)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:75)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.facebook.presto.spi.PrestoException: Expected exactly one coordinator sidecar, but found none
	at com.facebook.presto.nodeManager.PluginNodeManager.getSidecarNode(PluginNodeManager.java:84)
	at com.facebook.presto.sidecar.functionNamespace.NativeFunctionDefinitionProvider.getSidecarLocation(NativeFunctionDefinitionProvider.java:75)
	at com.facebook.presto.sidecar.functionNamespace.NativeFunctionDefinitionProvider.getUdfDefinition(NativeFunctionDefinitionProvider.java:64)
	... 24 more

java.lang.RuntimeException: Error executing query: SHOW FUNCTIONS
Query failed (#20250728_083208_00000_8it2y): Failed to get functions from sidecar.

	at com.facebook.presto.nativeworker.ContainerQueryRunner.execute(ContainerQueryRunner.java:475)
	at com.facebook.presto.tests.AbstractTestQueryFramework.computeActualWithCustomQueryRunner(AbstractTestQueryFramework.java:167)
	at com.facebook.presto.nativeworker.TestPrestoContainerSidecarInfrastructure.TestNativeClusterWithSidecar(TestPrestoContainerSidecarInfrastructure.java:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:135)
	at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:673)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:220)
	at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
	at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:945)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:193)
	at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
	at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.testng.TestRunner.privateRun(TestRunner.java:808)
	at org.testng.TestRunner.run(TestRunner.java:603)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:429)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:423)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:383)
	at org.testng.SuiteRunner.run(SuiteRunner.java:326)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1249)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
	at org.testng.TestNG.runSuites(TestNG.java:1092)
	at org.testng.TestNG.run(TestNG.java:1060)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:65)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)


===============================================
Default Suite
Total tests run: 1, Passes: 0, Failures: 1, Skips: 0
===============================================


Process finished with exit code 0

I have pushed the code with the changes, anything I might be missing here ?

@anandamideShakyan anandamideShakyan force-pushed the ci-infrastructure-testing branch from 02e35d3 to fa71375 Compare August 8, 2025 23:36
@anandamideShakyan
Copy link
Contributor Author

anandamideShakyan commented Aug 8, 2025

I was able to run and verify that all the test cases are passing.

Copy link
Contributor

@pdabre12 pdabre12 left a comment

Choose a reason for hiding this comment

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

Thanks @anandamideShakyan.
Can you please post a screenshot of the passing tests?

public void TestNativeClusterWithDelayedSidecar()
throws Exception
{
ContainerQueryRunner queryRunner = new ContainerQueryRunner(4, true, true, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's needed to check for delayed sidecar here. We can assume that the necessary conditions were satisfied before attempting to run a query.
WDTY @tdcmeehan ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will remove the delayedsidecar testcase if it is not needed. @tdcmeehan can you confirm ?

@anandamideShakyan anandamideShakyan changed the title ci : [native] Add container tests for sidecar ci(native): Add container tests for sidecar Jan 14, 2026
@anandamideShakyan anandamideShakyan force-pushed the ci-infrastructure-testing branch 4 times, most recently from 187dbb6 to 07408b7 Compare January 28, 2026 17:23
Copy link
Contributor

@czentgr czentgr left a comment

Choose a reason for hiding this comment

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

Looks good but a few things need to be addressed.

cd presto-native-execution
make velox-submodule

- name: Enable Docker BuildKit (daemon)
Copy link
Contributor

Choose a reason for hiding this comment

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

You have to install the BuildKit through a workflow like this

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.1

After that you should be good and you don't need this step.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@czentgr I added this in the workflow, also added env: DOCKER_BUILDKIT: 1 but still it is failing. Am I missing anything here ?

# -----------------------------
jobs:
build-worker-image:
runs-on: ubuntu-22.04
Copy link
Contributor

Choose a reason for hiding this comment

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

Use ubuntu-latest here and for the other jobs.

-Denable.docker.build.worker=true \
-pl '!:presto-product-tests,!:presto-router,!:presto-docs,!:presto-verifier,!:presto-test-coverage'

- name: Prune docker build cache
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we doing this? This container is cleared anyway. We don't have to worry about disk space.
Once we have build the docker images - where are they going? They are currently local on this machine. Each job is a self contained entity. Artifacts don't cross job boundaries. You will have to export the docker image and store it (upload artifact) and then download it in the actual test job.

<scope>runtime</scope>
</dependency>
</dependencies>
<!-- <dependencies>-->
Copy link
Contributor

Choose a reason for hiding this comment

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

Cleanup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I will remove it. It was throwing circular dependency error, so commented out this part and tried another approach.

@anandamideShakyan anandamideShakyan force-pushed the ci-infrastructure-testing branch 2 times, most recently from 2295a00 to 9f6deb2 Compare February 5, 2026 16:34
@anandamideShakyan anandamideShakyan force-pushed the ci-infrastructure-testing branch from 9f6deb2 to 3162668 Compare February 26, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants