Skip to content

Commit fd21f68

Browse files
Merge pull request #147 from cloudfoundry/fix-e2e
Fix e2e
2 parents 2b8647f + 0c7ab11 commit fd21f68

2 files changed

Lines changed: 24 additions & 19 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: E2E Tests on KinD
22

33
on:
4+
pull_request:
5+
branches: ["main"]
46
push:
5-
branches:
6-
- main
7+
branches: ["main"]
78
workflow_dispatch:
89

910
jobs:
@@ -59,7 +60,13 @@ jobs:
5960
default/$(kubectl get pod -n default -l app.kubernetes.io/name=fileserver \
6061
-o jsonpath='{.items[0].metadata.name}'):fileserver/v1/static/cnb_app_lifecycle/cnb_app_lifecycle.tgz
6162
- name: Run E2E tests for java
62-
run: cf push hello-java -f examples/hello-java/manifest.yaml
63+
run: |
64+
cf push hello-java -f examples/hello-java/manifest.yaml
65+
curl -s -f hello-java.apps.127-0-0-1.nip.io | grep -F "Hello World"
66+
cf delete hello-java -f -r
6367
- name: Run E2E tests for nodejs
64-
run: cf push hello-js -f examples/hello-js/manifest.yaml
65-
68+
run: |
69+
cf push hello-js -f examples/hello-js/manifest.yaml
70+
curl -s -f hello-js.apps.127-0-0-1.nip.io | grep -F "Hello World"
71+
cf delete hello-js -f -r
72+

examples/hello-java/src/main/java/org/cloudfoundry/demo/Application.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
import org.springframework.web.bind.annotation.GetMapping;
66
import org.springframework.web.bind.annotation.RestController;
77

8-
import java.util.ArrayList;
9-
import java.util.List;
10-
118
@SpringBootApplication(proxyBeanMethods=false)
129
@RestController
1310
public class Application {
@@ -16,19 +13,20 @@ public static void main(String[] args) {
1613
SpringApplication.run(Application.class, args);
1714
}
1815

16+
// CPU-intensive Fibonacci calculation
17+
private long fib(int n) {
18+
if (n <= 1) return n;
19+
return fib(n - 1) + fib(n - 2);
20+
}
21+
1922
@GetMapping("/")
20-
public String fibonacci() {
21-
List<Long> fibNumbers = new ArrayList<>();
22-
long a = 0, b = 1;
23+
public String index() {
24+
String instanceIndex = System.getenv("CF_INSTANCE_INDEX");
2325

24-
for (int i = 0; i < 40; i++) {
25-
fibNumbers.add(a);
26-
long next = a + b;
27-
a = b;
28-
b = next;
29-
}
26+
// Do CPU-intensive work
27+
long fibResult = fib(40);
28+
System.out.println("Computed Fibonacci(40): " + fibResult);
3029

31-
return fibNumbers.toString();
30+
return "Hello World! (CF_INSTANCE_INDEX: " + instanceIndex + ")\nFibonacci(40): " + fibResult + "\n";
3231
}
33-
3432
}

0 commit comments

Comments
 (0)