Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LEDfan committed Oct 13, 2023
1 parent 898a2f9 commit cdf1306
Show file tree
Hide file tree
Showing 28 changed files with 148 additions and 125 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,11 @@ jobs:
- name: Setup Docker Swarm
run: docker swarm init
- name: Pull Image
run: docker pull openanalytics/shinyproxy-demo:latest
run: docker pull openanalytics/shinyproxy-integration-test-app
- name: Run redis
run: docker run -d -p 6379:6379 redis
- name: Build with Maven
run: mvn -B -U clean install -DskipTests
- name: Copy Artifact
run: cp target/containerproxy-*-exec.jar target/containerproxy-app-recovery.jar
- name: debug
run: |
docker ps -a
kubectl get pod -A
- name: Run Tests
run: mvn -B test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void complex_recover_multiple_apps_after_shutdown(String backend, Map<Str
originalProxies2 = clientDemo2.getProxies();
Assertions.assertNotNull(originalProxies2);

// 6. create two proxies for user demo333
// 6. create two proxies for user demo3
id5 = clientDemo3.startProxy("01_hello");
Assertions.assertNotNull(id5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import eu.openanalytics.containerproxy.backend.strategy.IProxyTestStrategy;
import eu.openanalytics.containerproxy.model.runtime.Proxy;
import eu.openanalytics.containerproxy.service.StructuredLogger;
import eu.openanalytics.containerproxy.util.Retrying;

import java.net.HttpURLConnection;
Expand All @@ -31,6 +32,8 @@

public class NotInternalOnlyTestStrategy implements IProxyTestStrategy {

private final StructuredLogger log = StructuredLogger.create(getClass());

@Override
public boolean testProxy(Proxy proxy) {
URI targetURI = proxy.getContainers().get(0).getTargets().get(proxy.getId());
Expand All @@ -48,7 +51,9 @@ public boolean testProxy(Proxy proxy) {
if (Arrays.asList(200, 301, 302, 303, 307, 308).contains(responseCode)) {
return true;
}
log.warn(proxy, "Error during test strategy test: status code: " + responseCode);
} catch (Exception e) {
log.warn(proxy, e, "Exception during test strategy");
return false;
}
return false;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void launchProxy() throws DockerCertificateException, DockerException, In
List<Service> services = dockerClient.listServices();
Assertions.assertEquals(1, services.size());
Service service = services.get(0);
Assertions.assertEquals("openanalytics/shinyproxy-demo", service.spec().taskTemplate().containerSpec().image());
Assertions.assertEquals("openanalytics/shinyproxy-integration-test-app", service.spec().taskTemplate().containerSpec().image());

inst.proxyService.stopProxy(null, proxy, true).run();
}
Expand All @@ -85,7 +85,7 @@ public void launchProxyWithSecret() throws DockerCertificateException, DockerExc
List<Service> services = dockerClient.listServices();
Assertions.assertEquals(1, services.size());
Service service = services.get(0);
Assertions.assertEquals("openanalytics/shinyproxy-demo", service.spec().taskTemplate().containerSpec().image());
Assertions.assertEquals("openanalytics/shinyproxy-integration-test-app", service.spec().taskTemplate().containerSpec().image());

SecretBind secret1 = service.spec().taskTemplate().containerSpec().secrets().get(0);

Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/application-app-recovery_docker-swarm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ proxy:
specs:
- id: 01_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 02_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 03_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ proxy:
specs:
- id: 01_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 02_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 03_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/application-app-recovery_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ proxy:
specs:
- id: 01_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 02_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 03_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/application-app-recovery_docker_2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ proxy:
specs:
- id: 01_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 02_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 03_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/application-app-recovery_kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ proxy:
specs:
- id: 01_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 02_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 03_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/application-app-recovery_kubernetes_2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ proxy:
specs:
- id: 01_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 02_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 03_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ proxy:
specs:
- id: 01_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 02_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand All @@ -38,7 +38,7 @@ proxy:
value: itest-overridden
- id: 03_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ proxy:
specs:
- id: 01_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 02_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: 03_hello
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
8 changes: 4 additions & 4 deletions src/test/resources/application-parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proxy:
specs:
- id: big-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down Expand Up @@ -177,14 +177,14 @@ proxy:
- "yes"
- id: no-parameters
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
port: 3838
- id: with-access-control
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down Expand Up @@ -231,7 +231,7 @@ proxy:
- jeff
- id: default-values
container-specs:
- image: "openanalytics/shinyproxy-demo"
- image: "openanalytics/shinyproxy-integration-test-app"
cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
port-mapping:
- name: default
Expand Down
Loading

0 comments on commit cdf1306

Please sign in to comment.