47
47
@ SuiteDoc (
48
48
description = @ Desc ("This test suite is designed for testing metrics exposed by the Strimzi Metrics Reporter." ),
49
49
beforeTestSteps = {
50
- @ Step (value = "Create namespaces {@namespaceFirst} and {@namespaceSecond} ." , expected = "Namespaces {@namespaceFirst} and {@namespaceSecond} are created." ),
50
+ @ Step (value = "Create namespace {@namespace} ." , expected = "Namespace {@namespace} is created." ),
51
51
@ Step (value = "Deploy Cluster Operator." , expected = "Cluster Operator is deployed." ),
52
- @ Step (value = "Deploy Kafka {@kafkaClusterName } with metrics." , expected = "Kafka @{kafkaClusterName } is deployed." ),
53
- @ Step (value = "Deploy scraper Pod in namespace {@namespace} for collecting metrics from Strimzi pods." , expected = "Scraper Pods are deployed." ),
52
+ @ Step (value = "Deploy Kafka {@clusterName } with metrics." , expected = "Kafka @{clusterName } is deployed." ),
53
+ @ Step (value = "Deploy scraper Pod in namespace {@namespace} for collecting metrics from Strimzi pods." , expected = "Scraper Pods is deployed." ),
54
54
@ Step (value = "Create KafkaTopic resource." , expected = "KafkaTopic resource is Ready." ),
55
55
@ Step (value = "Create collector for Kafka." , expected = "Metrics collected in collectors structs." )
56
56
},
64
64
public class StrimziMetricsReporterST extends AbstractST {
65
65
private static final Logger LOGGER = LogManager .getLogger (StrimziMetricsReporterST .class );
66
66
67
+ private final String namespace = Environment .TEST_SUITE_NAMESPACE ;
68
+ private final String clusterName = "my-cluster" ;
69
+
67
70
private BaseMetricsCollector kafkaCollector ;
68
71
69
72
@ ParallelTest
@@ -93,28 +96,26 @@ void setupEnvironment() {
93
96
.createInstallation ()
94
97
.runInstallation ();
95
98
96
- cluster .setNamespace (Environment . TEST_SUITE_NAMESPACE );
99
+ cluster .setNamespace (namespace );
97
100
98
- String clusterName = "my-cluster" ;
99
- String topicName = KafkaTopicUtils .generateRandomNameOfTopic ();
100
- String scraperName = Environment .TEST_SUITE_NAMESPACE + "-" + TestConstants .SCRAPER_NAME ;
101
+ String scraperName = namespace + "-" + TestConstants .SCRAPER_NAME ;
101
102
102
103
// create resources without wait to deploy them simultaneously
103
104
resourceManager .createResourceWithWait (
104
- KafkaNodePoolTemplates .brokerPool (Environment . TEST_SUITE_NAMESPACE , KafkaNodePoolResource .getBrokerPoolName (clusterName ), clusterName , 3 ).build (),
105
- KafkaNodePoolTemplates .controllerPool (Environment . TEST_SUITE_NAMESPACE , KafkaNodePoolResource .getControllerPoolName (clusterName ), clusterName , 3 ).build ()
105
+ KafkaNodePoolTemplates .brokerPool (namespace , KafkaNodePoolResource .getBrokerPoolName (clusterName ), clusterName , 3 ).build (),
106
+ KafkaNodePoolTemplates .controllerPool (namespace , KafkaNodePoolResource .getControllerPoolName (clusterName ), clusterName , 3 ).build ()
106
107
);
107
108
resourceManager .createResourceWithoutWait (
108
- KafkaTemplates .kafkaWithStrimziMetricsReporter (Environment . TEST_SUITE_NAMESPACE , clusterName , 3 ).build (),
109
- ScraperTemplates .scraperPod (Environment . TEST_SUITE_NAMESPACE , scraperName ).build ()
109
+ KafkaTemplates .kafkaWithStrimziMetricsReporter (namespace , clusterName , 3 ).build (),
110
+ ScraperTemplates .scraperPod (namespace , scraperName ).build ()
110
111
);
111
112
112
113
// sync resources
113
114
resourceManager .synchronizeResources ();
114
115
115
- resourceManager .createResourceWithWait (KafkaTopicTemplates .topic (Environment . TEST_SUITE_NAMESPACE , topicName , clusterName , 5 , 2 ).build ());
116
+ resourceManager .createResourceWithWait (KafkaTopicTemplates .topic (namespace , KafkaTopicUtils . generateRandomNameOfTopic () , clusterName , 5 , 2 ).build ());
116
117
117
- String scraperPodName = ResourceManager .kubeClient ().listPodsByPrefixInName (Environment . TEST_SUITE_NAMESPACE , scraperName ).get (0 ).getMetadata ().getName ();
118
+ String scraperPodName = ResourceManager .kubeClient ().listPodsByPrefixInName (namespace , scraperName ).get (0 ).getMetadata ().getName ();
118
119
119
120
// wait some time for metrics to be stable, at least reconciliation interval + 10s
120
121
LOGGER .info ("Sleeping for {} to give operators and operands some time to stable the metrics values before collecting" ,
@@ -123,7 +124,7 @@ void setupEnvironment() {
123
124
124
125
kafkaCollector = new BaseMetricsCollector .Builder ()
125
126
.withScraperPodName (scraperPodName )
126
- .withNamespaceName (Environment . TEST_SUITE_NAMESPACE )
127
+ .withNamespaceName (namespace )
127
128
.withComponent (KafkaMetricsComponent .create (clusterName ))
128
129
.build ();
129
130
0 commit comments