I am trying to follow this documentation to add integration tests to a cloud function:
https://cloud.google.com/functions/docs/samples/functions-storage-integration-test
The first step (setup) basically starts a process using java.lang.Process:
@BeforeClass
public static void setUp() throws IOException {
// Get the sample's base directory (the one containing a pom.xml file)
String baseDir = System.getProperty("user.dir");
// Emulate the function locally by running the Functions Framework Maven plugin
emulatorProcess = new ProcessBuilder()
.command("mvn", "function:run -Drun.functionTarget=function.MyFunction")
.directory(new File("C:/"))
.start();
}
This throws the error
java.io.IOException: Cannot run program "mvn" (in directory "C:"): CreateProcess error=2, The system cannot find the file specified
The same happens if I instead of C:\ I follow the example and use
String baseDir = System.getProperty("user.dir");
The funny thing is that if I just open a console and type
mvn function:run -Drun.functionTarget=function.MyFunction
When I pass the full path of the mvn command I end up with
CreateProcess error=193, %1 is not a valid Win32 application.
The path looks like "C:\Users\carlos.palma\apache-maven-3.8.8\bin\mvn"
I can execute the cloud function locally. Is there something I'm missing related to the setup of this "Functions Framework Maven plugin" ?