-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Add e2e testcases for REST based remote functions #23777
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ | |
|
||
set -e | ||
|
||
java -Dconfig=/opt/function-server/etc/config.properties -jar /opt/presto-remote-server >> log1.txt 2>&1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove temporary log. |
||
|
||
$PRESTO_HOME/bin/launcher run |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,6 +362,12 @@ | |
<include>presto-cli-*-executable.jar</include> | ||
</includes> | ||
</resource> | ||
<resource> | ||
<directory>${project.parent.basedir}/presto-main/target</directory> | ||
<includes> | ||
<include>presto-remote-function-server-executable.jar</include> | ||
</includes> | ||
</resource> | ||
<resource> | ||
<directory>${project.parent.basedir}/presto-server/target</directory> | ||
<includes> | ||
|
@@ -433,7 +439,7 @@ | |
<args> | ||
<BUILD_TYPE>Release</BUILD_TYPE> | ||
<DEPENDENCY_IMAGE>presto-native-dependency:latest</DEPENDENCY_IMAGE> | ||
<EXTRA_CMAKE_FLAGS>-DPRESTO_ENABLE_TESTING=OFF</EXTRA_CMAKE_FLAGS> | ||
<EXTRA_CMAKE_FLAGS>-DPRESTO_ENABLE_REMOTE_FUNCTIONS=ON</EXTRA_CMAKE_FLAGS> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you keep existing CMAKE flags |
||
<NUM_THREADS>2</NUM_THREADS> | ||
<BASE_IMAGE>ubuntu:22.04</BASE_IMAGE> | ||
<OSNAME>ubuntu</OSNAME> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,19 @@ public static void createNativeWorkerConfigProperties(int coordinatorPort, Strin | |
createPropertiesFile("testcontainers/" + nodeId + "/etc/config.properties", properties); | ||
} | ||
|
||
public static void createNativeWorkerConfigPropertiesWithFunctionServer(int coordinatorPort, int functionServerPort, String nodeId) | ||
throws IOException | ||
{ | ||
Properties properties = new Properties(); | ||
properties.setProperty("presto.version", "testversion"); | ||
properties.setProperty("http-server.http.port", "7777"); | ||
properties.setProperty("discovery.uri", "http://presto-coordinator:" + coordinatorPort); | ||
properties.setProperty("system-memory-gb", "2"); | ||
properties.setProperty("native.sidecar", "false"); | ||
properties.setProperty("remote-function-server.rest.url", "http://presto-coordinator:" + functionServerPort); | ||
createPropertiesFile("testcontainers/" + nodeId + "/etc/config.properties", properties); | ||
} | ||
|
||
public static void createCoordinatorConfigProperties(int port) | ||
throws IOException | ||
{ | ||
|
@@ -93,6 +106,8 @@ public static void createCoordinatorConfigProperties(int port) | |
properties.setProperty("http-server.http.port", Integer.toString(port)); | ||
properties.setProperty("discovery-server.enabled", "true"); | ||
properties.setProperty("discovery.uri", "http://presto-coordinator:" + port); | ||
properties.setProperty("list-built-in-functions-only", "false"); | ||
properties.setProperty("native-execution-enabled", "false"); | ||
|
||
// Get native worker system properties and add them to the coordinator properties | ||
Map<String, String> nativeWorkerProperties = NativeQueryRunnerUtils.getNativeWorkerSystemProperties(); | ||
|
@@ -103,6 +118,52 @@ public static void createCoordinatorConfigProperties(int port) | |
createPropertiesFile("testcontainers/coordinator/etc/config.properties", properties); | ||
} | ||
|
||
public static void createFunctionNamespaceRemoteProperties() | ||
throws IOException | ||
{ | ||
Properties properties = new Properties(); | ||
properties.setProperty("function-namespace-manager.name", "rest"); | ||
properties.setProperty("supported-function-languages", "Java"); | ||
properties.setProperty("function-implementation-type", "REST"); | ||
|
||
String directoryPath = "testcontainers/function-namespace"; | ||
File directory = new File(directoryPath); | ||
if (!directory.exists()) { | ||
directory.mkdirs(); | ||
} | ||
|
||
createPropertiesFile("testcontainers/coordinator/etc/function-namespace/remote.properties", properties); | ||
} | ||
|
||
public static void createFunctionNamespaceRemotePropertiesWithFunctionServer(int functionServerPort) | ||
throws IOException | ||
{ | ||
Properties properties = new Properties(); | ||
properties.setProperty("function-namespace-manager.name", "rest"); | ||
properties.setProperty("supported-function-languages", "Java"); | ||
properties.setProperty("function-implementation-type", "REST"); | ||
properties.setProperty("rest-based-function-manager.rest.url", "http://localhost:" + functionServerPort); | ||
|
||
String directoryPath = "testcontainers/function-namespace"; | ||
File directory = new File(directoryPath); | ||
if (!directory.exists()) { | ||
directory.mkdirs(); | ||
} | ||
|
||
createPropertiesFile("testcontainers/coordinator/etc/function-namespace/remote.properties", properties); | ||
} | ||
|
||
public static void createFunctionServerConfigProperties(int functionServerPort) | ||
throws IOException | ||
{ | ||
Properties properties = new Properties(); | ||
properties.setProperty("http-server.http.port", String.valueOf(functionServerPort)); | ||
properties.setProperty("regex-library", "RE2J"); | ||
properties.setProperty("parse-decimal-literals-as-double", "true"); | ||
|
||
createPropertiesFile("testcontainers/coordinator/etc/function-server/config.properties", properties); | ||
} | ||
|
||
public static void createCoordinatorJvmConfig() | ||
throws IOException | ||
|
||
|
@@ -161,6 +222,11 @@ public static void createCoordinatorEntryPointScript() | |
{ | ||
String scriptContent = "#!/bin/sh\n" + | ||
"set -e\n" + | ||
"java " + | ||
// "-Dplugin.dir=/opt/presto-remote-server/function-server-plugin " + | ||
// "-Dconfig=/opt/presto-remote-server/function-server-etc/config.properties " + | ||
// "-jar /opt/presto-remote-server >> log1.txt 2>&1 & \n" + | ||
"-Dconfig=/opt/function-server/etc/config.properties -jar /opt/presto-remote-server >> log1.txt 2>&1 & \n" + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
"$PRESTO_HOME/bin/launcher run\n"; | ||
createScriptFile("testcontainers/coordinator/entrypoint.sh", scriptContent); | ||
} | ||
|
@@ -204,10 +270,6 @@ public static void createPropertiesFile(String filePath, Properties properties) | |
parentDir.mkdirs(); | ||
} | ||
|
||
if (file.exists()) { | ||
throw new IOException("File exists: " + filePath); | ||
} | ||
|
||
try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)) { | ||
for (String key : properties.stringPropertyNames()) { | ||
writer.write(key + "=" + properties.getProperty(key) + "\n"); | ||
|
@@ -224,10 +286,6 @@ public static void createScriptFile(String filePath, String scriptContent) | |
parentDir.mkdirs(); | ||
} | ||
|
||
if (file.exists()) { | ||
throw new IOException("File exists: " + filePath); | ||
} | ||
|
||
try (OutputStream output = new FileOutputStream(file); | ||
OutputStreamWriter writer = new OutputStreamWriter(output, StandardCharsets.UTF_8)) { | ||
writer.write(scriptContent); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove unwanted line