Skip to content

Commit

Permalink
Merge pull request #628 from RafalKorepta/rk/remove-leftovers-from-mm…
Browse files Browse the repository at this point in the history
…2-test

Remove other mirror maker 2 topics from test
  • Loading branch information
Rafal Korepta authored Aug 2, 2023
2 parents 5633e9a + 34bead3 commit 6c2b26e
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 20 deletions.
2 changes: 1 addition & 1 deletion charts/connectors/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type: application
# The chart version and the app version are not the same and will not track
# together. The chart version is a semver representation of changes to this
# chart.
version: 0.1.2
version: 0.1.3

# The app version is the default version of Redpanda Connectors to install.
appVersion: v1.0.2
Expand Down
3 changes: 3 additions & 0 deletions charts/connectors/ci/01-default-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ connectors:
enabled: true
ca:
secretRef: redpanda-default-cert

logging:
level: trace
2 changes: 1 addition & 1 deletion charts/connectors/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ spec:
timeoutSeconds: {{ .Values.deployment.livenessProbe.timeoutSeconds }}
readinessProbe:
httpGet:
path: /
path: /connectors
port: rest-api
scheme: HTTP
initialDelaySeconds: {{ .Values.deployment.readinessProbe.initialDelaySeconds }}
Expand Down
83 changes: 67 additions & 16 deletions charts/connectors/templates/tests/01-mm2-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
apiVersion: v1
kind: Pod
metadata:
name: {{ include "connectors.fullname" . }}-mm2-test
name: {{ include "connectors.fullname" . }}-mm2-test-{{ randNumeric 3 }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- with include "full.labels" . }}
Expand All @@ -40,9 +40,22 @@ spec:
- |
set -x
curl http://{{ include "connectors.serviceName" . }}:{{ .Values.connectors.restPort }}/connectors
curl -H 'Content-Type: application/json' http://{{ include "connectors.serviceName" . }}:{{ .Values.connectors.restPort }}/connectors --data-raw '{
"name": "mm2",
curl http://{{ include "connectors.serviceName" . }}:{{ .Values.connectors.restPort }}/connectors && echo
rpk profile create test
rpk profile set tls.enabled={{.Values.connectors.brokerTLS.enabled}} brokers={{ .Values.connectors.bootstrapServers }}
{{- if .Values.connectors.brokerTLS.ca.secretRef }}
rpk profile set tls.ca={{ printf "/redpanda-certs/%s" (default "ca.crt" .Values.connectors.brokerTLS.ca.secretNameOverwrite) }}
{{- end }}
rpk topic list
rpk topic create test-topic
rpk topic list
echo "Test message!" | rpk topic produce test-topic
CONNECTOR_NAME=mm2-$RANDOM
cat << 'EOF' > /tmp/mm2-conf.json
{
"name": "CONNECTOR_NAME",
"config": {
"connector.class": "org.apache.kafka.connect.mirror.MirrorSourceConnector",
"topics": "test-topic",
Expand All @@ -66,19 +79,57 @@ spec:
"source.cluster.sasl.mechanism": "PLAIN",
"target.cluster.sasl.mechanism": "PLAIN"
}
}'
rpk profile create test
rpk profile set tls.enabled={{.Values.connectors.brokerTLS.enabled}} brokers={{ .Values.connectors.bootstrapServers }}
{{- if .Values.connectors.brokerTLS.ca.secretRef }}
rpk profile set tls.ca={{ printf "/redpanda-certs/%s" (default "ca.crt" .Values.connectors.brokerTLS.ca.secretNameOverwrite) }}
{{- end }}
rpk topic list
rpk topic create test-topic
rpk topic list
echo "Test message!" | rpk topic produce test-topic
}
EOF
sed -i "s/CONNECTOR_NAME/$CONNECTOR_NAME/g" /tmp/mm2-conf.json
max_iteration=10
for i in $(seq 1 $max_iteration)
do
curl -v -H 'Content-Type: application/json' http://{{ include "connectors.serviceName" . }}:{{ .Values.connectors.restPort }}/connectors -d @/tmp/mm2-conf.json && echo
result=$?
if [[ $result -eq 0 ]]
then
echo "Result successful"
break
else
echo "Result unsuccessful"
sleep 1
fi
done
if [[ $result -ne 0 ]]
then
echo "mm2 connector can not be destroyed!!!"
exit 1
fi
rpk topic consume source.test-topic -n 1 | grep "Test message!"
curl -X DELETE http://{{ include "connectors.serviceName" . }}:{{ .Values.connectors.restPort }}/connectors/mm2
rpk topic delete test-topic
for i in $(seq 1 $max_iteration)
do
curl -X DELETE http://{{ include "connectors.serviceName" . }}:{{ .Values.connectors.restPort }}/connectors/$CONNECTOR_NAME && echo
result=$?
if [[ $result -eq 0 ]]
then
echo "Result successful"
break
else
echo "Result unsuccessful"
sleep 1
fi
done
if [[ $result -ne 0 ]]
then
echo "mm2 connector can not be destroyed!!!"
exit 1
fi
curl http://{{ include "connectors.serviceName" . }}:{{ .Values.connectors.restPort }}/connectors && echo
rpk topic delete test-topic source.test-topic mm2-offset-syncs.target.internal
{{- if .Values.connectors.brokerTLS.ca.secretRef }}
volumeMounts:
- mountPath: /redpanda-certs
Expand Down
4 changes: 2 additions & 2 deletions charts/connectors/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ deployment:
timeoutSeconds: 1
readinessProbe:
initialDelaySeconds: 60
failureThreshold: 3
failureThreshold: 2
periodSeconds: 10
successThreshold: 1
successThreshold: 3
timeoutSeconds: 5

# -- The maximum time in seconds for a deployment to make progress before it is
Expand Down

0 comments on commit 6c2b26e

Please sign in to comment.