Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
psav committed Oct 11, 2023
1 parent 9bd8cfb commit 4d95ffb
Show file tree
Hide file tree
Showing 7 changed files with 631 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/kuttl/test-kafka-msk/00-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: test-kafka-msk
spec:
finalizers:
- kubernetes
26 changes: 26 additions & 0 deletions tests/kuttl/test-kafka-msk/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: test-kafka-msk
namespace: test-kafka-msk
status:
conditions:
- reason: ZooKeeperStorage
status: "True"
type: Warning
- reason: KafkaStorage
status: "True"
type: Warning
- status: "True"
type: Ready
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaUser
metadata:
labels:
strimzi.io/cluster: test-kafka-msk
name: test-kafka-msk-connect
namespace: test-kafka-msk
status:
username: test-kafka-msk-connect
342 changes: 342 additions & 0 deletions tests/kuttl/test-kafka-msk/01-pods.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,342 @@
---
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: test-kafka-msk
namespace: test-kafka-msk
spec:
entityOperator:
tlsSidecar:
resources:
limits:
cpu: 100m
memory: 100Mi
requests:
cpu: 50m
memory: 50Mi
topicOperator:
resources:
limits:
cpu: 200m
memory: 500Mi
requests:
cpu: 50m
memory: 250Mi
userOperator:
resources:
limits:
cpu: 400m
memory: 500Mi
requests:
cpu: 50m
memory: 250Mi
kafka:
authorization:
type: simple
config:
offsets.topic.replication.factor: 1
jvmOptions: {}
listeners:
- authentication:
type: scram-sha-512
name: tls
port: 9093
tls: true
type: internal
metricsConfig:
type: jmxPrometheusExporter
valueFrom:
configMapKeyRef:
key: metrics
name: test-kafka-msk-metrics
optional: false
replicas: 1
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 250m
memory: 600Mi
storage:
type: ephemeral
version: 3.4.0
zookeeper:
replicas: 1
resources:
limits:
cpu: 350m
memory: 800Mi
requests:
cpu: 200m
memory: 400Mi
storage:
type: ephemeral
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaUser
metadata:
labels:
strimzi.io/cluster: test-kafka-msk
name: test-kafka-msk-connect
namespace: test-kafka-msk
spec:
authentication:
type: scram-sha-512
authorization:
acls:
- host: '*'
operation: All
resource:
name: '*'
patternType: literal
type: topic
- host: '*'
operation: All
resource:
name: '*'
patternType: literal
type: group
- host: '*'
operation: All
resource:
name: '*'
patternType: literal
type: cluster
type: simple
---
apiVersion: v1
data:
metrics: |-
{
"metrics": {
"lowercaseOutputName": true,
"rules": [
{
"labels": {
"clientId": "$3",
"partition": "$5",
"topic": "$4"
},
"name": "kafka_server_$1_$2",
"pattern": "kafka.server<type=(.+), name=(.+), clientId=(.+), topic=(.+), partition=(.*)><>Value",
"type": "GAUGE"
},
{
"labels": {
"broker": "$4:$5",
"clientId": "$3"
},
"name": "kafka_server_$1_$2",
"pattern": "kafka.server<type=(.+), name=(.+), clientId=(.+), brokerHost=(.+), brokerPort=(.+)><>Value",
"type": "GAUGE"
},
{
"labels": {
"cipher": "$5",
"listener": "$2",
"networkProcessor": "$3",
"protocol": "$4"
},
"name": "kafka_server_$1_connections_tls_info",
"pattern": "kafka.server<type=(.+), cipher=(.+), protocol=(.+), listener=(.+), networkProcessor=(.+)><>connections",
"type": "GAUGE"
},
{
"labels": {
"clientSoftwareName": "$2",
"clientSoftwareVersion": "$3",
"listener": "$4",
"networkProcessor": "$5"
},
"name": "kafka_server_$1_connections_software",
"pattern": "kafka.server<type=(.+), clientSoftwareName=(.+), clientSoftwareVersion=(.+), listener=(.+), networkProcessor=(.+)><>connections",
"type": "GAUGE"
},
{
"labels": {
"listener": "$2",
"networkProcessor": "$3"
},
"name": "kafka_server_$1_$4",
"pattern": "kafka.server<type=(.+), listener=(.+), networkProcessor=(.+)><>(.+):",
"type": "GAUGE"
},
{
"labels": {
"listener": "$2",
"networkProcessor": "$3"
},
"name": "kafka_server_$1_$4",
"pattern": "kafka.server<type=(.+), listener=(.+), networkProcessor=(.+)><>(.+)",
"type": "GAUGE"
},
{
"name": "kafka_$1_$2_$3_percent",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+)Percent\\w*><>MeanRate",
"type": "GAUGE"
},
{
"name": "kafka_$1_$2_$3_percent",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+)Percent\\w*><>Value",
"type": "GAUGE"
},
{
"labels": {
"$4": "$5"
},
"name": "kafka_$1_$2_$3_percent",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+)Percent\\w*, (.+)=(.+)><>Value",
"type": "GAUGE"
},
{
"labels": {
"$4": "$5",
"$6": "$7"
},
"name": "kafka_$1_$2_$3_total",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+)PerSec\\w*, (.+)=(.+), (.+)=(.+)><>Count",
"type": "COUNTER"
},
{
"labels": {
"$4": "$5"
},
"name": "kafka_$1_$2_$3_total",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+)PerSec\\w*, (.+)=(.+)><>Count",
"type": "COUNTER"
},
{
"name": "kafka_$1_$2_$3_total",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+)PerSec\\w*><>Count",
"type": "COUNTER"
},
{
"labels": {
"$4": "$5",
"$6": "$7"
},
"name": "kafka_$1_$2_$3",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+), (.+)=(.+), (.+)=(.+)><>Value",
"type": "GAUGE"
},
{
"labels": {
"$4": "$5"
},
"name": "kafka_$1_$2_$3",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+), (.+)=(.+)><>Value",
"type": "GAUGE"
},
{
"name": "kafka_$1_$2_$3",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+)><>Value",
"type": "GAUGE"
},
{
"labels": {
"$4": "$5",
"$6": "$7"
},
"name": "kafka_$1_$2_$3_count",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+), (.+)=(.+), (.+)=(.+)><>Count",
"type": "COUNTER"
},
{
"labels": {
"$4": "$5",
"$6": "$7",
"quantile": "0.$8"
},
"name": "kafka_$1_$2_$3",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+), (.+)=(.*), (.+)=(.+)><>(\\d+)thPercentile",
"type": "GAUGE"
},
{
"labels": {
"$4": "$5"
},
"name": "kafka_$1_$2_$3_count",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+), (.+)=(.+)><>Count",
"type": "COUNTER"
},
{
"labels": {
"$4": "$5",
"quantile": "0.$6"
},
"name": "kafka_$1_$2_$3",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+), (.+)=(.*)><>(\\d+)thPercentile",
"type": "GAUGE"
},
{
"name": "kafka_$1_$2_$3_count",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+)><>Count",
"type": "COUNTER"
},
{
"labels": {
"quantile": "0.$4"
},
"name": "kafka_$1_$2_$3",
"pattern": "kafka.(\\w+)<type=(.+), name=(.+)><>(\\d+)thPercentile",
"type": "GAUGE"
}
]
}
}
kind: ConfigMap
metadata:
name: test-kafka-msk-metrics
namespace: test-kafka-msk
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: strimzi-topic-operator
namespace: test-kafka-msk
labels:
app: strimzi
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: strimzi-topic-operator
namespace: test-kafka-msk
labels:
app: strimzi
rules:
- verbs:
- get
- list
- watch
- create
- patch
- update
- delete
apiGroups:
- kafka.strimzi.io
resources:
- kafkatopics
- kafkatopics/status
- verbs:
- create
apiGroups:
- ''
resources:
- events
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: strimzi-topic-operator
namespace: test-kafka-msk
labels:
app: strimzi
subjects:
- kind: ServiceAccount
name: strimzi-topic-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: strimzi-topic-operator
10 changes: 10 additions & 0 deletions tests/kuttl/test-kafka-msk/02-json-asserts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: sleep 5
- script: kubectl get secret --namespace=test-kafka-msk test-kafka-msk-connect -o json > /tmp/test-kafka-msk-user
- script: kubectl get secret --namespace=test-kafka-msk test-kafka-msk-cluster-ca-cert -o json > /tmp/test-kafka-msk-cluster-ca-cert

- script: sh create_json.sh
- script: kubectl apply -f /tmp/managed-secret.yaml -n test-kafka-msk
Loading

0 comments on commit 4d95ffb

Please sign in to comment.