tzulitai commented on a change in pull request #250: URL: https://github.com/apache/flink-statefun/pull/250#discussion_r686674790
########## File path: statefun-e2e-tests/statefun-smoke-e2e-golang/pom.xml ########## @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.flink</groupId> + <artifactId>statefun-smoke-e2e-multilang-base</artifactId> + <version>3.1-SNAPSHOT</version> + <relativePath>../statefun-smoke-e2e-multilang-base/pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>statefun-smoke-e2e-golang</artifactId> + + <dependencies> + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + <version>${protobuf.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- Generate the Command messages --> + <plugin> + <groupId>com.github.os72</groupId> + <artifactId>protoc-jar-maven-plugin</artifactId> + <version>${protoc-jar-maven-plugin.version}</version> + <executions> + <execution> + <id>generate-protobuf-sources</id> + <phase>generate-sources</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <includeStdTypes>true</includeStdTypes> + <protocVersion>${protobuf.version}</protocVersion> + <cleanOutputFolder>true</cleanOutputFolder> + <inputDirectories> + <inputDirectory>src/main/protobuf</inputDirectory> + </inputDirectories> + <outputDirectory>${basedir}/target/generated-sources/protoc-jar</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> Review comment: I've pushed a change to master that should simplify this POM. The goal is that all multilang SDK smoke E2Es' POMs, by using `statefun-smoke-e2e-multilang-base` as the parent POM, should only need to worry about dependencies and build plugins that the function code requires. For non-JVM languages SDK smoke tests like this one, this essentially means their POMs should be empty. Can you rebase on latest master and apply this change? ```suggestion <artifactId>statefun-smoke-e2e-golang</artifactId> ``` ########## File path: statefun-e2e-tests/statefun-smoke-e2e-golang/src/test/java/org/apache/flink/statefun/e2e/smoke/golang/SmokeVerificationGolangE2E.java ########## @@ -0,0 +1,59 @@ +package org.apache.flink.statefun.e2e.smoke.golang; + +import java.nio.file.Path; +import java.nio.file.Paths; +import org.apache.flink.statefun.e2e.common.StatefulFunctionsAppContainers; +import org.apache.flink.statefun.e2e.smoke.driver.testutils.SmokeRunner; +import org.apache.flink.statefun.e2e.smoke.driver.testutils.SmokeRunnerParameters; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.images.builder.ImageFromDockerfile; + +public class SmokeVerificationGolangE2E { + + private static final Logger LOG = LoggerFactory.getLogger(SmokeVerificationGolangE2E.class); + private static final int NUM_WORKERS = 2; + + @Test(timeout = 1_000 * 60 * 10) + public void runWith() throws Throwable { + SmokeRunnerParameters parameters = new SmokeRunnerParameters(); + parameters.setNumberOfFunctionInstances(128); + parameters.setMessageCount(100_000); + parameters.setMaxFailures(1); + + GenericContainer<?> remoteFunction = configureRemoteFunction(parameters); + + StatefulFunctionsAppContainers.Builder builder = + StatefulFunctionsAppContainers.builder("flink-statefun-cluster", NUM_WORKERS) + .withBuildContextFileFromClasspath("remote-module", "/remote-module/") + .dependsOn(remoteFunction); + + SmokeRunner.run(parameters, builder); + } + + private GenericContainer<?> configureRemoteFunction(SmokeRunnerParameters parameters) { + Path targetDirPath = Paths.get(System.getProperty("user.dir") + "/target/"); + ImageFromDockerfile remoteFunctionImage = + new ImageFromDockerfile("remote-function-image") + .withFileFromClasspath("Dockerfile", "Dockerfile.remote-function") + .withFileFromPath("source/", goSdkPath()) + .withFileFromPath("smoketest/", remoteFunctionGoSourcePath()) + .withFileFromPath(".", targetDirPath); Review comment: I don't think you don't need to do this for the Golang container image. The Java smoke E2E needed to add `target/` as the Docker build context because the built function jar was located there. You're doing essentially that already in line 43 (including the Go source files in the build context). ########## File path: statefun-e2e-tests/statefun-smoke-e2e-golang/src/test/java/org/apache/flink/statefun/e2e/smoke/golang/SmokeVerificationGolangE2E.java ########## @@ -0,0 +1,59 @@ +package org.apache.flink.statefun.e2e.smoke.golang; + +import java.nio.file.Path; +import java.nio.file.Paths; +import org.apache.flink.statefun.e2e.common.StatefulFunctionsAppContainers; +import org.apache.flink.statefun.e2e.smoke.driver.testutils.SmokeRunner; +import org.apache.flink.statefun.e2e.smoke.driver.testutils.SmokeRunnerParameters; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.images.builder.ImageFromDockerfile; + +public class SmokeVerificationGolangE2E { + + private static final Logger LOG = LoggerFactory.getLogger(SmokeVerificationGolangE2E.class); + private static final int NUM_WORKERS = 2; + + @Test(timeout = 1_000 * 60 * 10) + public void runWith() throws Throwable { + SmokeRunnerParameters parameters = new SmokeRunnerParameters(); + parameters.setNumberOfFunctionInstances(128); + parameters.setMessageCount(100_000); + parameters.setMaxFailures(1); + + GenericContainer<?> remoteFunction = configureRemoteFunction(parameters); + + StatefulFunctionsAppContainers.Builder builder = + StatefulFunctionsAppContainers.builder("flink-statefun-cluster", NUM_WORKERS) + .withBuildContextFileFromClasspath("remote-module", "/remote-module/") + .dependsOn(remoteFunction); + + SmokeRunner.run(parameters, builder); + } + + private GenericContainer<?> configureRemoteFunction(SmokeRunnerParameters parameters) { + Path targetDirPath = Paths.get(System.getProperty("user.dir") + "/target/"); + ImageFromDockerfile remoteFunctionImage = + new ImageFromDockerfile("remote-function-image") + .withFileFromClasspath("Dockerfile", "Dockerfile.remote-function") + .withFileFromPath("source/", goSdkPath()) + .withFileFromPath("smoketest/", remoteFunctionGoSourcePath()) + .withFileFromPath(".", targetDirPath); + + return new GenericContainer<>(remoteFunctionImage) + .withNetworkAliases("remote-function-host") + .withLogConsumer(new Slf4jLogConsumer(LOG)) + .withEnv("NUM_FN_INSTANCES", Integer.toString(parameters.getNumberOfFunctionInstances())); Review comment: Looks like this env var isn't being used in the Golang smoke E2E. Should be able to remove this then. As a matter of fact, I think it can be removed on the Java smoke side as well as its mostly just a optimization (which isn't too relevant). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
