diff --git a/images/runtime/Dockerfile b/images/runtime/Dockerfile index e2fdc392..3aef82ba 100644 --- a/images/runtime/Dockerfile +++ b/images/runtime/Dockerfile @@ -4,6 +4,8 @@ COPY src/main/c/libfnunixsocket.so /function/runtime/lib/ RUN ["/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java", "-Xshare:dump"] +RUN addgroup --system --gid 1000 fn && adduser --uid 1000 --gid 1000 fn + # UseCGroupMemoryLimitForHeap looks up /sys/fs/cgroup/memory/memory.limit_in_bytes inside the container to determine # what the heap should be set to. This is an experimental feature at the moment, thus we need to unlock to use it. # diff --git a/integration-tests/src/test/java/com/fnproject/fn/integrationtest/FlowTest.java b/integration-tests/src/test/java/com/fnproject/fn/integrationtest/FlowTest.java index 09733c24..45dd0bc9 100644 --- a/integration-tests/src/test/java/com/fnproject/fn/integrationtest/FlowTest.java +++ b/integration-tests/src/test/java/com/fnproject/fn/integrationtest/FlowTest.java @@ -26,7 +26,7 @@ public class FlowTest { public void shouldInvokeBasicFlow() throws Exception { IntegrationTestRule.TestContext tc = testRule.newTest(); tc.withDirFrom("funcs/flowBasic").rewritePOM(); - tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local"); + tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local"); tc.runFn("config", "app", tc.appName(), "COMPLETER_BASE_URL", testRule.getFlowURL()); CmdResult r = tc.runFnWithInput("1", "invoke", tc.appName(), "flowbasic"); assertThat(r.getStdout()).isEqualTo("4"); @@ -37,7 +37,7 @@ public void shouldInvokeBasicFlow() throws Exception { public void shouldInvokeBasicFlowJDK8() throws Exception { IntegrationTestRule.TestContext tc = testRule.newTest(); tc.withDirFrom("funcs/flowBasicJDK8").rewritePOM(); - tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local"); + tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local"); tc.runFn("config", "app", tc.appName(), "COMPLETER_BASE_URL", testRule.getFlowURL()); CmdResult r = tc.runFnWithInput("1", "invoke", tc.appName(), "flowbasicj8"); assertThat(r.getStdout()).isEqualTo("4"); @@ -48,7 +48,7 @@ public void shouldInvokeBasicFlowJDK8() throws Exception { public void shouldExerciseAllFlow() throws Exception { IntegrationTestRule.TestContext tc = testRule.newTest(); tc.withDirFrom("funcs/flowAllFeatures").rewritePOM(); - tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local"); + tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local"); tc.runFn("config", "app", tc.appName(), "COMPLETER_BASE_URL", testRule.getFlowURL()); CmdResult r = tc.runFnWithInput("1", "invoke", tc.appName(), "flowallfeatures"); assertThat(r.getStdout()).contains("Everything worked"); @@ -73,8 +73,7 @@ public void shouldCallExitHooks() throws Exception { IntegrationTestRule.TestContext tc = testRule.newTest(); tc.withDirFrom("funcs/flowExitHooks").rewritePOM(); tc.runFn("--verbose", "build", "--no-cache"); - - tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local"); + tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local"); tc.runFn("config", "app", tc.appName(), "COMPLETER_BASE_URL", testRule.getFlowURL()); tc.runFn("config", "app", tc.appName(), "TERMINATION_HOOK_URL", "http://" + testRule.getDockerLocalhost() + ":" + 8000 + "/exited"); CmdResult r = tc.runFnWithInput("1", "invoke", tc.appName(), "flowexithooks"); @@ -92,7 +91,7 @@ public void shouldCallExitHooks() throws Exception { public void shouldHandleTimeouts() throws Exception { IntegrationTestRule.TestContext tc = testRule.newTest(); tc.withDirFrom("funcs/flowTimeouts").rewritePOM(); - tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local"); + tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local"); tc.runFn("config", "app", tc.appName(), "COMPLETER_BASE_URL", testRule.getFlowURL()); CmdResult r = tc.runFn("invoke", tc.appName(), "flowtimeouts"); assertThat(r.getStdout()).contains("timeout"); diff --git a/integration-tests/src/test/java/com/fnproject/fn/integrationtest/FunctionsTest.java b/integration-tests/src/test/java/com/fnproject/fn/integrationtest/FunctionsTest.java index 62e078d0..ab73d8b8 100644 --- a/integration-tests/src/test/java/com/fnproject/fn/integrationtest/FunctionsTest.java +++ b/integration-tests/src/test/java/com/fnproject/fn/integrationtest/FunctionsTest.java @@ -32,7 +32,7 @@ public void shouldCallExistingFn() throws Exception { IntegrationTestRule.TestContext tc = testRule.newTest(); tc.withDirFrom("funcs/simpleFunc").rewritePOM(); - tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local"); + tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local"); tc.runFn("config", "app", tc.appName(), "GREETING", "Salutations"); CmdResult r1 = tc.runFnWithInput("", "invoke", tc.appName(), "simplefunc"); @@ -46,12 +46,11 @@ public void shouldCallExistingFn() throws Exception { @Test() public void checkBoilerPlate() throws Exception { for (String runtime : new String[]{"java8", "java11"}) { - IntegrationTestRule.TestContext tc = testRule.newTest(); - + IntegrationTestRule.TestContext tc = testRule.newTest(); String fnName = "bp" + runtime; tc.runFn("init", "--runtime", runtime, "--name", fnName); tc.rewritePOM(); - tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local"); + tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local"); CmdResult rs = tc.runFnWithInput("wibble", "invoke", tc.appName(), fnName); assertThat(rs.getStdout()).contains("Hello, wibble!"); } @@ -67,8 +66,7 @@ public static class InspectResponse { public void shouldHandleTrigger() throws Exception { IntegrationTestRule.TestContext tc = testRule.newTest(); tc.withDirFrom("funcs/httpgwfunc").rewritePOM(); - - tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local"); + tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local"); // Get me the trigger URL CmdResult output = tc.runFn("inspect", "trigger", tc.appName(), "httpgwfunc", "trig");