Skip to content

Commit

Permalink
Fix fabric8io#1565: CRD's Enums are prefixed with "Raw: " keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanKanojia committed Jun 22, 2019
1 parent 6189735 commit 00bbf9e
Show file tree
Hide file tree
Showing 10 changed files with 3,381 additions and 58 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

### 4.3-SNAPSHOT
Bugs
* Fix #1565: CRD's Enums are prefixed with Raw keyword

Improvements
* Fix #1589: Move HorizontalPodAutoscaler to autoscaling/v1
* Fix #1553: Allow to explicitly set non-matching field selectors using `withoutField`

* assertNotNull replaced with assertTrue for boolean statements in unit tests
* assertNotNull replaced with assertTrue for boolean statements in unit tests

Dependency Upgrade

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public class RawCustomResourceIT {

private CustomResourceDefinitionContext customResourceDefinitionContext;

private CustomResourceDefinitionContext customResourceDefinitionContextWithOpenAPIV3Schema;

@Before
public void initCustomResourceDefinition() {
currentNamespace = session.getNamespace();
Expand All @@ -64,6 +66,18 @@ public void initCustomResourceDefinition() {
.withPlural("animals")
.withScope("Namespaced")
.build();

// Create a Custom Resource Definition with OpenAPIV3 validation schema
CustomResourceDefinition aComplexCrd = client.customResourceDefinitions().load(getClass().getResourceAsStream("/kafka-crd.yml")).get();
client.customResourceDefinitions().create(aComplexCrd);

customResourceDefinitionContextWithOpenAPIV3Schema = new CustomResourceDefinitionContext.Builder()
.withName("kafkas.kafka.strimzi.io")
.withGroup("kafka.strimzi.io")
.withPlural("kafkas")
.withScope("Namespaced")
.withVersion("v1beta1")
.build();
}

@Test
Expand Down Expand Up @@ -101,9 +115,21 @@ public void testCrud() throws IOException {
client.customResource(customResourceDefinitionContext).delete(currentNamespace);
}

@Test
public void testCustomResourceDefinitionCreationWithOpenAPIV3Schema() throws IOException {

Map<String, Object> ret = client.customResource(customResourceDefinitionContextWithOpenAPIV3Schema).create(currentNamespace, getClass().getResourceAsStream("/kafka-cr.yml"));
assertThat(ret).isNotNull();
assertThat(((Map<String, Object>)ret.get("metadata")).get("name")).isEqualTo("kafka-single");

// cleanup
client.customResource(customResourceDefinitionContextWithOpenAPIV3Schema).delete(currentNamespace, "kafka-single");
}

@After
public void cleanup() {
// Delete Custom Resource Definition Animals:
client.customResourceDefinitions().withName(customResourceDefinitionContext.getName()).delete();
client.customResourceDefinitions().withName(customResourceDefinitionContextWithOpenAPIV3Schema.getName()).delete();
}
}
25 changes: 25 additions & 0 deletions kubernetes-itests/src/test/resources/kafka-cr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: kafka.strimzi.io/v1beta1
kind: Kafka
metadata:
name: kafka-single
spec:
kafka:
version: 2.1.1
replicas: 1
listeners:
plain: {}
tls: {}
config:
offsets.topic.replication.factor: 1
transaction.state.log.replication.factor: 1
transaction.state.log.min.isr: 1
log.message.format.version: "2.1"
storage:
type: ephemeral
zookeeper:
replicas: 1
storage:
type: ephemeral
entityOperator:
topicOperator: {}
userOperator: {}
Loading

0 comments on commit 00bbf9e

Please sign in to comment.