From 998a9fd4b710e9a0a613f8e4891b33265e7eee9c Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Wed, 25 Nov 2026 18:29:29 +0100 Subject: [PATCH] tests: make tests more reliable on slow clusters --- .../kuttl/configuration/10-assert.yaml.j2 | 2 +- .../configuration/10-install-kafka.yaml.j2 | 17 +++++++++++------ .../kraft-kerberos/20-install-kafka.yaml.j2 | 5 +++++ .../60-scale-controller-up.yaml.j2 | 5 +++++ .../70-scale-controller-down.yaml.j2 | 5 +++++ .../kuttl/management-access/10_kafka.yaml.j2 | 5 +++++ .../kuttl/opa-kraft/30-install-kafka.yaml.j2 | 5 +++++ .../kuttl/smoke-kraft/30-install-kafka.yaml.j2 | 5 +++++ .../kuttl/topic/10-install-kafka.yaml.j2 | 5 +++++ .../kuttl/upgrade/02-install-kafka.yaml.j2 | 5 +++++ 10 files changed, 52 insertions(+), 7 deletions(-) diff --git a/tests/templates/kuttl/configuration/10-assert.yaml.j2 b/tests/templates/kuttl/configuration/10-assert.yaml.j2 index 507b9c6d2..b8446be18 100644 --- a/tests/templates/kuttl/configuration/10-assert.yaml.j2 +++ b/tests/templates/kuttl/configuration/10-assert.yaml.j2 @@ -17,7 +17,7 @@ spec: resources: limits: # value set in the role configuration - cpu: 500m + cpu: 1200m # value set in the rolegroup configuration memory: 3Gi requests: diff --git a/tests/templates/kuttl/configuration/10-install-kafka.yaml.j2 b/tests/templates/kuttl/configuration/10-install-kafka.yaml.j2 index c026bdaae..ea7191a8f 100644 --- a/tests/templates/kuttl/configuration/10-install-kafka.yaml.j2 +++ b/tests/templates/kuttl/configuration/10-install-kafka.yaml.j2 @@ -30,7 +30,7 @@ spec: # Inherit the default value '250m' set by the operator # min: '250m' # Override the default value '1' set by the operator - max: '500m' + max: '1200m' # memory: # Inherit the default value '1Gi' set by the operator # limit: '1Gi' @@ -45,8 +45,8 @@ spec: # cpu: # Inherit the default value '250m' set by the operator # min: '250m' - # Inherit the value '1000m' set in the role configuration - # max: '1000m' + # Inherit the value '1200m' set in the role configuration + # max: '1200m' memory: # Override the default value '1Gi' set by the operator limit: '2Gi' @@ -56,6 +56,11 @@ spec: capacity: '1Gi' replicas: 1 brokers: + # Work around KAFKA-19354: after a slow start a broker can get stuck fetching from a + # follower controller. A longer fetch timeout (default 2000) avoids that. Fixed in Kafka 4.2.0. + configOverrides: + broker.properties: + controller.quorum.fetch.timeout.ms: "10000" config: logging: enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }} @@ -64,7 +69,7 @@ spec: # Inherit the default value '250m' set by the operator # min: '250m' # Override the default value '1' set by the operator - max: '500m' + max: '1200m' # memory: # Inherit the default value '2Gi' set by the operator # limit: '2Gi' @@ -79,8 +84,8 @@ spec: # cpu: # Inherit the default value '250m' set by the operator # min: '250m' - # Inherit the value '1000m' set in the role configuration - # max: '1000m' + # Inherit the value '1200m' set in the role configuration + # max: '1200m' memory: # Override the default value '2Gi' set by the operator limit: '3Gi' diff --git a/tests/templates/kuttl/kraft-kerberos/20-install-kafka.yaml.j2 b/tests/templates/kuttl/kraft-kerberos/20-install-kafka.yaml.j2 index 4d6f62085..d2ee6c982 100644 --- a/tests/templates/kuttl/kraft-kerberos/20-install-kafka.yaml.j2 +++ b/tests/templates/kuttl/kraft-kerberos/20-install-kafka.yaml.j2 @@ -61,5 +61,10 @@ commands: gracefulShutdownTimeout: 30s # speed up tests roleGroups: default: + # Work around KAFKA-19354: after a slow start a broker can get stuck fetching from a + # follower controller. A longer fetch timeout (default 2000) avoids that. Fixed in Kafka 4.2.0. + configOverrides: + broker.properties: + controller.quorum.fetch.timeout.ms: "10000" replicas: 3 EOF diff --git a/tests/templates/kuttl/kraft-kerberos/60-scale-controller-up.yaml.j2 b/tests/templates/kuttl/kraft-kerberos/60-scale-controller-up.yaml.j2 index 05c0fb4ac..89017da6a 100644 --- a/tests/templates/kuttl/kraft-kerberos/60-scale-controller-up.yaml.j2 +++ b/tests/templates/kuttl/kraft-kerberos/60-scale-controller-up.yaml.j2 @@ -37,5 +37,10 @@ commands: brokers: roleGroups: default: + # See 20-install-kafka.yaml.j2. Must be repeated here, because + # kubectl apply would otherwise remove the override set in the earlier step. + configOverrides: + broker.properties: + controller.quorum.fetch.timeout.ms: "10000" replicas: 3 EOF diff --git a/tests/templates/kuttl/kraft-kerberos/70-scale-controller-down.yaml.j2 b/tests/templates/kuttl/kraft-kerberos/70-scale-controller-down.yaml.j2 index 4cb03758e..ff2d1058b 100644 --- a/tests/templates/kuttl/kraft-kerberos/70-scale-controller-down.yaml.j2 +++ b/tests/templates/kuttl/kraft-kerberos/70-scale-controller-down.yaml.j2 @@ -50,5 +50,10 @@ commands: gracefulShutdownTimeout: 30s # speed up tests roleGroups: default: + # See 20-install-kafka.yaml.j2. Must be repeated here, because + # kubectl apply would otherwise remove the override set in the earlier step. + configOverrides: + broker.properties: + controller.quorum.fetch.timeout.ms: "10000" replicas: 3 EOF diff --git a/tests/templates/kuttl/management-access/10_kafka.yaml.j2 b/tests/templates/kuttl/management-access/10_kafka.yaml.j2 index ca2976982..211453a58 100644 --- a/tests/templates/kuttl/management-access/10_kafka.yaml.j2 +++ b/tests/templates/kuttl/management-access/10_kafka.yaml.j2 @@ -71,6 +71,11 @@ spec: default: replicas: 1 brokers: + # Work around KAFKA-19354: after a slow start a broker can get stuck fetching from a + # follower controller. A longer fetch timeout (default 2000) avoids that. Fixed in Kafka 4.2.0. + configOverrides: + broker.properties: + controller.quorum.fetch.timeout.ms: "10000" config: gracefulShutdownTimeout: 30s # speed up tests roleGroups: diff --git a/tests/templates/kuttl/opa-kraft/30-install-kafka.yaml.j2 b/tests/templates/kuttl/opa-kraft/30-install-kafka.yaml.j2 index b897a9216..e40c9fafc 100644 --- a/tests/templates/kuttl/opa-kraft/30-install-kafka.yaml.j2 +++ b/tests/templates/kuttl/opa-kraft/30-install-kafka.yaml.j2 @@ -47,6 +47,11 @@ commands: default: replicas: 3 brokers: + # Work around KAFKA-19354: after a slow start a broker can get stuck fetching from a + # follower controller. A longer fetch timeout (default 2000) avoids that. Fixed in Kafka 4.2.0. + configOverrides: + broker.properties: + controller.quorum.fetch.timeout.ms: "10000" config: logging: enableVectorAgent: true diff --git a/tests/templates/kuttl/smoke-kraft/30-install-kafka.yaml.j2 b/tests/templates/kuttl/smoke-kraft/30-install-kafka.yaml.j2 index f8040b9df..a785f4baf 100644 --- a/tests/templates/kuttl/smoke-kraft/30-install-kafka.yaml.j2 +++ b/tests/templates/kuttl/smoke-kraft/30-install-kafka.yaml.j2 @@ -131,6 +131,11 @@ spec: broker.properties: compression.type: uncompressed # overridden by role group below controller.quorum.election.backoff.max.ms: "2000" + # Work around KAFKA-19354: after a slow start a broker can get stuck fetching from a + # follower controller. A longer fetch timeout (default 2000) avoids that. Fixed in Kafka 4.2.0. + # The "default" role group below overrides this with 3000 on purpose (asserted in + # 31-assert.yaml), so only the other role groups get 10000. + controller.quorum.fetch.timeout.ms: "10000" envOverrides: COMMON_VAR: role-value # overridden by role group below ROLE_VAR: role-value # only defined here at role level diff --git a/tests/templates/kuttl/topic/10-install-kafka.yaml.j2 b/tests/templates/kuttl/topic/10-install-kafka.yaml.j2 index e563db1eb..fa6420233 100644 --- a/tests/templates/kuttl/topic/10-install-kafka.yaml.j2 +++ b/tests/templates/kuttl/topic/10-install-kafka.yaml.j2 @@ -28,6 +28,11 @@ spec: default: replicas: 1 brokers: + # Work around KAFKA-19354: after a slow start a broker can get stuck fetching from a + # follower controller. A longer fetch timeout (default 2000) avoids that. Fixed in Kafka 4.2.0. + configOverrides: + broker.properties: + controller.quorum.fetch.timeout.ms: "10000" config: gracefulShutdownTimeout: 30s # speed up tests roleGroups: diff --git a/tests/templates/kuttl/upgrade/02-install-kafka.yaml.j2 b/tests/templates/kuttl/upgrade/02-install-kafka.yaml.j2 index 0875083a8..47cd6afb5 100644 --- a/tests/templates/kuttl/upgrade/02-install-kafka.yaml.j2 +++ b/tests/templates/kuttl/upgrade/02-install-kafka.yaml.j2 @@ -49,6 +49,11 @@ spec: vectorAggregatorConfigMapName: vector-aggregator-discovery {% endif %} brokers: + # Work around KAFKA-19354: after a slow start a broker can get stuck fetching from a + # follower controller. A longer fetch timeout (default 2000) avoids that. Fixed in Kafka 4.2.0. + configOverrides: + broker.properties: + controller.quorum.fetch.timeout.ms: "10000" config: gracefulShutdownTimeout: 30s # speed up tests logging: