Skip to content

Commit 79c5784

Browse files
authored
Merge pull request #192 from fnproject/nl-cap
fn user added to runtime image
2 parents b0e110c + 712aa4a commit 79c5784

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

images/runtime/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ COPY src/main/c/libfnunixsocket.so /function/runtime/lib/
44

55
RUN ["/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java", "-Xshare:dump"]
66

7+
RUN addgroup --system --gid 1000 fn && adduser --uid 1000 --gid 1000 fn
8+
79
# UseCGroupMemoryLimitForHeap looks up /sys/fs/cgroup/memory/memory.limit_in_bytes inside the container to determine
810
# what the heap should be set to. This is an experimental feature at the moment, thus we need to unlock to use it.
911
#

integration-tests/src/test/java/com/fnproject/fn/integrationtest/FlowTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class FlowTest {
2626
public void shouldInvokeBasicFlow() throws Exception {
2727
IntegrationTestRule.TestContext tc = testRule.newTest();
2828
tc.withDirFrom("funcs/flowBasic").rewritePOM();
29-
tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local");
29+
tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local");
3030
tc.runFn("config", "app", tc.appName(), "COMPLETER_BASE_URL", testRule.getFlowURL());
3131
CmdResult r = tc.runFnWithInput("1", "invoke", tc.appName(), "flowbasic");
3232
assertThat(r.getStdout()).isEqualTo("4");
@@ -37,7 +37,7 @@ public void shouldInvokeBasicFlow() throws Exception {
3737
public void shouldInvokeBasicFlowJDK8() throws Exception {
3838
IntegrationTestRule.TestContext tc = testRule.newTest();
3939
tc.withDirFrom("funcs/flowBasicJDK8").rewritePOM();
40-
tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local");
40+
tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local");
4141
tc.runFn("config", "app", tc.appName(), "COMPLETER_BASE_URL", testRule.getFlowURL());
4242
CmdResult r = tc.runFnWithInput("1", "invoke", tc.appName(), "flowbasicj8");
4343
assertThat(r.getStdout()).isEqualTo("4");
@@ -48,7 +48,7 @@ public void shouldInvokeBasicFlowJDK8() throws Exception {
4848
public void shouldExerciseAllFlow() throws Exception {
4949
IntegrationTestRule.TestContext tc = testRule.newTest();
5050
tc.withDirFrom("funcs/flowAllFeatures").rewritePOM();
51-
tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local");
51+
tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local");
5252
tc.runFn("config", "app", tc.appName(), "COMPLETER_BASE_URL", testRule.getFlowURL());
5353
CmdResult r = tc.runFnWithInput("1", "invoke", tc.appName(), "flowallfeatures");
5454
assertThat(r.getStdout()).contains("Everything worked");
@@ -73,8 +73,7 @@ public void shouldCallExitHooks() throws Exception {
7373
IntegrationTestRule.TestContext tc = testRule.newTest();
7474
tc.withDirFrom("funcs/flowExitHooks").rewritePOM();
7575
tc.runFn("--verbose", "build", "--no-cache");
76-
77-
tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local");
76+
tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local");
7877
tc.runFn("config", "app", tc.appName(), "COMPLETER_BASE_URL", testRule.getFlowURL());
7978
tc.runFn("config", "app", tc.appName(), "TERMINATION_HOOK_URL", "http://" + testRule.getDockerLocalhost() + ":" + 8000 + "/exited");
8079
CmdResult r = tc.runFnWithInput("1", "invoke", tc.appName(), "flowexithooks");
@@ -92,7 +91,7 @@ public void shouldCallExitHooks() throws Exception {
9291
public void shouldHandleTimeouts() throws Exception {
9392
IntegrationTestRule.TestContext tc = testRule.newTest();
9493
tc.withDirFrom("funcs/flowTimeouts").rewritePOM();
95-
tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local");
94+
tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local");
9695
tc.runFn("config", "app", tc.appName(), "COMPLETER_BASE_URL", testRule.getFlowURL());
9796
CmdResult r = tc.runFn("invoke", tc.appName(), "flowtimeouts");
9897
assertThat(r.getStdout()).contains("timeout");

integration-tests/src/test/java/com/fnproject/fn/integrationtest/FunctionsTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void shouldCallExistingFn() throws Exception {
3232
IntegrationTestRule.TestContext tc = testRule.newTest();
3333
tc.withDirFrom("funcs/simpleFunc").rewritePOM();
3434

35-
tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local");
35+
tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local");
3636
tc.runFn("config", "app", tc.appName(), "GREETING", "Salutations");
3737

3838
CmdResult r1 = tc.runFnWithInput("", "invoke", tc.appName(), "simplefunc");
@@ -46,12 +46,11 @@ public void shouldCallExistingFn() throws Exception {
4646
@Test()
4747
public void checkBoilerPlate() throws Exception {
4848
for (String runtime : new String[]{"java8", "java11"}) {
49-
IntegrationTestRule.TestContext tc = testRule.newTest();
50-
49+
IntegrationTestRule.TestContext tc = testRule.newTest();
5150
String fnName = "bp" + runtime;
5251
tc.runFn("init", "--runtime", runtime, "--name", fnName);
5352
tc.rewritePOM();
54-
tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local");
53+
tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local");
5554
CmdResult rs = tc.runFnWithInput("wibble", "invoke", tc.appName(), fnName);
5655
assertThat(rs.getStdout()).contains("Hello, wibble!");
5756
}
@@ -67,8 +66,7 @@ public static class InspectResponse {
6766
public void shouldHandleTrigger() throws Exception {
6867
IntegrationTestRule.TestContext tc = testRule.newTest();
6968
tc.withDirFrom("funcs/httpgwfunc").rewritePOM();
70-
71-
tc.runFn("--verbose", "deploy", "--app", tc.appName(), "--local");
69+
tc.runFn("--verbose", "deploy", "--create-app", "--app", tc.appName(), "--local");
7270

7371
// Get me the trigger URL
7472
CmdResult output = tc.runFn("inspect", "trigger", tc.appName(), "httpgwfunc", "trig");

0 commit comments

Comments
 (0)