forked from spring-cloud/spring-cloud-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/spring-cloud/spring-cloud-k…
- Loading branch information
Showing
11 changed files
with
133 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...g/springframework/cloud/kubernetes/fabric8/discovery/Fabric8CatalogWatchContextTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright 2012-2023 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.cloud.kubernetes.fabric8.discovery; | ||
|
||
import java.util.List; | ||
import java.util.stream.Stream; | ||
|
||
import io.fabric8.kubernetes.api.model.ObjectReference; | ||
import io.fabric8.kubernetes.api.model.ObjectReferenceBuilder; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import org.springframework.cloud.kubernetes.commons.discovery.EndpointNameAndNamespace; | ||
|
||
/** | ||
* @author wind57 | ||
*/ | ||
class Fabric8CatalogWatchContextTests { | ||
|
||
@Test | ||
void stateWithASingleElementNameNotNull() { | ||
|
||
Stream<ObjectReference> referenceStream = Stream | ||
.of(new ObjectReferenceBuilder().withName("a").withNamespace("default").build()); | ||
|
||
List<EndpointNameAndNamespace> result = Fabric8CatalogWatchContext.state(referenceStream); | ||
Assertions.assertEquals(result.size(), 1); | ||
Assertions.assertEquals(result.get(0).endpointName(), "a"); | ||
Assertions.assertEquals(result.get(0).namespace(), "default"); | ||
|
||
} | ||
|
||
@Test | ||
void stateWithASingleElementNameNull() { | ||
|
||
Stream<ObjectReference> referenceStream = Stream | ||
.of(new ObjectReferenceBuilder().withName(null).withNamespace("default").build()); | ||
|
||
List<EndpointNameAndNamespace> result = Fabric8CatalogWatchContext.state(referenceStream); | ||
Assertions.assertEquals(result.size(), 1); | ||
Assertions.assertNull(result.get(0).endpointName()); | ||
Assertions.assertEquals(result.get(0).namespace(), "default"); | ||
|
||
} | ||
|
||
@Test | ||
void stateWithTwoElementsNameNull() { | ||
|
||
Stream<ObjectReference> referenceStream = Stream.of( | ||
new ObjectReferenceBuilder().withName(null).withNamespace("defaultNull").build(), | ||
new ObjectReferenceBuilder().withName("a").withNamespace("defaultA").build()); | ||
|
||
List<EndpointNameAndNamespace> result = Fabric8CatalogWatchContext.state(referenceStream); | ||
Assertions.assertEquals(result.size(), 2); | ||
Assertions.assertEquals(result.get(0).endpointName(), "a"); | ||
Assertions.assertEquals(result.get(0).namespace(), "defaultA"); | ||
Assertions.assertNull(result.get(1).endpointName()); | ||
Assertions.assertEquals(result.get(1).namespace(), "defaultNull"); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...loud-kubernetes-test-support/src/main/resources/kafka/kafka-configmap-startup-script.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: kafka-start-config-script | ||
data: | ||
kafka_start.sh: | | ||
#!/bin/sh | ||
sed -i '/KAFKA_ZOOKEEPER_CONNECT/d' /etc/confluent/docker/configure | ||
sed -i 's/cub zk-ready/echo ignore zk-ready/' /etc/confluent/docker/ensure | ||
KAFKA_CLUSTER_ID="$(kafka-storage random-uuid)" | ||
echo "kafka-storage format --ignore-formatted -t $KAFKA_CLUSTER_ID -c /etc/kafka/kafka.properties" >> /etc/confluent/docker/ensure | ||
/etc/confluent/docker/run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
spring-cloud-kubernetes-test-support/src/main/resources/zookeeper/zookeeper-deployment.yaml
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
spring-cloud-kubernetes-test-support/src/main/resources/zookeeper/zookeeper-service.yaml
This file was deleted.
Oops, something went wrong.