Skip to content

Commit d5859ff

Browse files
committed
refactored
Signed-off-by: wind57 <[email protected]>
1 parent 58029b8 commit d5859ff

File tree

9 files changed

+25
-508
lines changed

9 files changed

+25
-508
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.springframework.context.annotation.Bean;
3535
import org.springframework.context.annotation.Primary;
3636

37-
import static org.springframework.cloud.kubernetes.fabric8.catalog.watch.Fabric8CatalogWatchEndpointSlicesFilterIT.TestConfig;
37+
import static org.springframework.cloud.kubernetes.fabric8.catalog.watch.Fabric8CatalogWatchEndpointSlicesIT.TestConfig;
3838
import static org.springframework.cloud.kubernetes.fabric8.catalog.watch.TestAssertions.assertLogStatement;
3939
import static org.springframework.cloud.kubernetes.fabric8.catalog.watch.TestAssertions.invokeAndAssert;
4040

@@ -43,7 +43,7 @@
4343
*/
4444
@SpringBootTest(classes = { KubernetesCatalogWatchAutoConfiguration.class, TestConfig.class, Application.class },
4545
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
46-
class Fabric8CatalogWatchEndpointSlicesFilterIT extends Fabric8CatalogWatchBase {
46+
class Fabric8CatalogWatchEndpointSlicesIT extends Fabric8CatalogWatchBase {
4747

4848
@LocalServerPort
4949
private int port;
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.it;
17+
package org.springframework.cloud.kubernetes.k8s.client.catalog.watcher;
1818

1919
import java.io.IOException;
2020
import java.io.StringReader;
@@ -26,13 +26,13 @@
2626
import io.kubernetes.client.util.Config;
2727
import org.junit.jupiter.api.BeforeAll;
2828
import org.junit.jupiter.api.extension.ExtendWith;
29+
import org.testcontainers.k3s.K3sContainer;
2930

3031
import org.springframework.boot.test.system.OutputCaptureExtension;
3132
import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties;
3233
import org.springframework.cloud.kubernetes.integration.tests.commons.Commons;
3334
import org.springframework.cloud.kubernetes.integration.tests.commons.fabric8_client.Util;
3435
import org.springframework.test.context.TestPropertySource;
35-
import org.testcontainers.k3s.K3sContainer;
3636

3737
/**
3838
* @author wind57
@@ -62,10 +62,10 @@ protected static void beforeAll() {
6262
util = new Util(K3S);
6363
}
6464

65-
protected static KubernetesDiscoveryProperties discoveryProperties(boolean useEndpointSlices) {
66-
return new KubernetesDiscoveryProperties(true, false, Set.of(NAMESPACE, NAMESPACE_A), true, 60, false, null,
67-
Set.of(443, 8443), Map.of(), null, KubernetesDiscoveryProperties.Metadata.DEFAULT, 0, useEndpointSlices,
68-
false, null);
65+
protected static KubernetesDiscoveryProperties discoveryProperties(boolean useEndpointSlices,
66+
Set<String> namespaces) {
67+
return new KubernetesDiscoveryProperties(true, false, namespaces, true, 60, false, null, Set.of(443, 8443),
68+
Map.of(), null, KubernetesDiscoveryProperties.Metadata.DEFAULT, 0, useEndpointSlices, false, null);
6969
}
7070

7171
protected static ApiClient apiClient() {
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.it;
17+
package org.springframework.cloud.kubernetes.k8s.client.catalog.watcher;
1818

1919
import java.util.Set;
2020

@@ -30,15 +30,14 @@
3030
import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties;
3131
import org.springframework.cloud.kubernetes.integration.tests.commons.Images;
3232
import org.springframework.cloud.kubernetes.integration.tests.commons.Phase;
33-
import org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.Application;
3433
import org.springframework.context.annotation.Bean;
3534
import org.springframework.context.annotation.Primary;
3635

37-
import static org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.it.TestAssertions.assertLogStatement;
38-
import static org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.it.TestAssertions.invokeAndAssert;
36+
import static org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.TestAssertions.assertLogStatement;
37+
import static org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.TestAssertions.invokeAndAssert;
3938

4039
@SpringBootTest(classes = { KubernetesClientCatalogWatchEndpointSlicesIT.TestConfig.class, Application.class },
41-
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
40+
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
4241
class KubernetesClientCatalogWatchEndpointSlicesIT extends KubernetesClientCatalogWatchBase {
4342

4443
@LocalServerPort
@@ -92,7 +91,7 @@ ApiClient client() {
9291
@Bean
9392
@Primary
9493
KubernetesDiscoveryProperties kubernetesDiscoveryProperties() {
95-
return discoveryProperties(true);
94+
return discoveryProperties(true, Set.of(NAMESPACE, NAMESPACE_A));
9695
}
9796

9897
}
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.it;
17+
package org.springframework.cloud.kubernetes.k8s.client.catalog.watcher;
1818

1919
import java.util.Set;
2020

@@ -30,15 +30,14 @@
3030
import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties;
3131
import org.springframework.cloud.kubernetes.integration.tests.commons.Images;
3232
import org.springframework.cloud.kubernetes.integration.tests.commons.Phase;
33-
import org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.Application;
3433
import org.springframework.context.annotation.Bean;
3534
import org.springframework.context.annotation.Primary;
3635

37-
import static org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.it.TestAssertions.assertLogStatement;
38-
import static org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.it.TestAssertions.invokeAndAssert;
36+
import static org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.TestAssertions.assertLogStatement;
37+
import static org.springframework.cloud.kubernetes.k8s.client.catalog.watcher.TestAssertions.invokeAndAssert;
3938

4039
@SpringBootTest(classes = { KubernetesClientCatalogWatchEndpointsIT.TestConfig.class, Application.class },
41-
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
40+
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
4241
class KubernetesClientCatalogWatchEndpointsIT extends KubernetesClientCatalogWatchBase {
4342

4443
@LocalServerPort
@@ -92,7 +91,7 @@ ApiClient client() {
9291
@Bean
9392
@Primary
9493
KubernetesDiscoveryProperties kubernetesDiscoveryProperties() {
95-
return discoveryProperties(false);
94+
return discoveryProperties(false, Set.of(NAMESPACE, NAMESPACE_A));
9695
}
9796

9897
}

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/k8s/client/catalog/watcher/KubernetesClientCatalogWatchIT.java

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)