|
16 | 16 |
|
17 | 17 | package dev.snowdrop.example;
|
18 | 18 |
|
19 |
| -import java.net.MalformedURLException; |
20 | 19 | import java.net.URL;
|
21 | 20 |
|
22 |
| -import org.junit.jupiter.api.BeforeEach; |
23 | 21 | import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
|
24 | 22 |
|
25 | 23 | import io.dekorate.testing.annotation.Inject;
|
| 24 | +import io.dekorate.testing.annotation.Named; |
26 | 25 | import io.dekorate.testing.openshift.annotation.OpenshiftIntegrationTest;
|
27 | 26 | import io.fabric8.kubernetes.client.KubernetesClient;
|
28 |
| -import io.fabric8.openshift.api.model.Route; |
29 |
| -import io.fabric8.openshift.client.OpenShiftClient; |
30 | 27 |
|
31 | 28 | @EnabledIfSystemProperty(named = "unmanaged-test", matches = "true")
|
32 | 29 | @OpenshiftIntegrationTest(deployEnabled = false, buildEnabled = false, pushEnabled = false)
|
33 | 30 | public class UnmanagedOpenShiftIT extends AbstractOpenShiftIT {
|
34 | 31 | @Inject
|
35 | 32 | KubernetesClient kubernetesClient;
|
36 | 33 |
|
37 |
| - String baseUrl; |
38 |
| - |
39 |
| - @BeforeEach |
40 |
| - public void setup() throws MalformedURLException { |
41 |
| - // TODO: In Dekorate 1.7, we can inject Routes directly, so we won't need to do this: |
42 |
| - Route route = kubernetesClient.adapt(OpenShiftClient.class).routes().withName("configmap").get(); |
43 |
| - String protocol = route.getSpec().getTls() == null ? "http" : "https"; |
44 |
| - int port = "http".equals(protocol) ? 80 : 443; |
45 |
| - URL url = new URL(protocol, route.getSpec().getHost(), port, "/"); |
46 |
| - baseUrl = url.toString(); |
47 |
| - } |
| 34 | + @Inject |
| 35 | + @Named("configmap") |
| 36 | + URL baseUrl; |
48 | 37 |
|
49 | 38 | @Override
|
50 | 39 | protected String baseURL() {
|
51 |
| - return baseUrl; |
| 40 | + return baseUrl.toString(); |
52 | 41 | }
|
53 | 42 |
|
54 | 43 | @Override
|
|
0 commit comments