19
19
using System . Collections . Generic ;
20
20
using Confluent . Kafka . Admin ;
21
21
using Xunit ;
22
+ using Confluent . Kafka . TestsCommon ;
22
23
23
24
24
25
namespace Confluent . Kafka . IntegrationTests
@@ -90,7 +91,7 @@ public void AdminClient_IncrementalAlterConfigs(string bootstrapServers)
90
91
Assert . Equal ( "10001" , describeConfigsResult [ 0 ] . Entries [ "flush.ms" ] . Value ) ;
91
92
Assert . Equal ( "delete,compact" , describeConfigsResult [ 0 ] . Entries [ "cleanup.policy" ] . Value ) ;
92
93
93
- // 4 . test ValidateOnly = true does not update config entry.
94
+ // 5 . test ValidateOnly = true does not update config entry.
94
95
toUpdate = new Dictionary < ConfigResource , List < ConfigEntry > >
95
96
{
96
97
{ configResource , new List < ConfigEntry > { new ConfigEntry { Name = "flush.ms" , Value = "20002" , IncrementalOperation = AlterConfigOpType . Set } } }
@@ -100,7 +101,7 @@ public void AdminClient_IncrementalAlterConfigs(string bootstrapServers)
100
101
describeConfigsResult = adminClient . DescribeConfigsAsync ( new List < ConfigResource > { configResource } ) . Result ;
101
102
Assert . Equal ( "10001" , describeConfigsResult [ 0 ] . Entries [ "flush.ms" ] . Value ) ;
102
103
103
- // 5 . test updating broker resource.
104
+ // 6 . test updating broker resource.
104
105
toUpdate = new Dictionary < ConfigResource , List < ConfigEntry > >
105
106
{
106
107
{
@@ -110,7 +111,7 @@ public void AdminClient_IncrementalAlterConfigs(string bootstrapServers)
110
111
} ;
111
112
adminClient . IncrementalAlterConfigsAsync ( toUpdate ) . Wait ( ) ;
112
113
113
- // 6 . test updating more than one resource.
114
+ // 7 . test updating more than one resource.
114
115
var configResource2 = new ConfigResource { Name = topicName2 , Type = ResourceType . Topic } ;
115
116
toUpdate = new Dictionary < ConfigResource , List < ConfigEntry > >
116
117
{
@@ -123,6 +124,30 @@ public void AdminClient_IncrementalAlterConfigs(string bootstrapServers)
123
124
Assert . Equal ( 2 , describeConfigsResult . Count ) ;
124
125
Assert . Equal ( "222" , describeConfigsResult [ 0 ] . Entries [ "flush.ms" ] . Value ) ;
125
126
Assert . Equal ( "333" , describeConfigsResult [ 1 ] . Entries [ "flush.ms" ] . Value ) ;
127
+
128
+ // TODO: enable this test for the classic run too, when
129
+ // Confluent Platform test cluster is upgraded to 8.0.0.
130
+ if ( ! TestConsumerGroupProtocol . IsClassic ( ) ) {
131
+ // 8. test updating ResourceType.Group
132
+ string groupName = Guid . NewGuid ( ) . ToString ( ) ;
133
+ LogToFile ( $ "Testing IncrementalAlterConfigs for consumer group { groupName } ") ;
134
+ var groupConfigResource = new ConfigResource { Name = groupName , Type = ResourceType . Group } ;
135
+ var groupToUpdate = new Dictionary < ConfigResource , List < ConfigEntry > >
136
+ {
137
+ {
138
+ groupConfigResource ,
139
+ new List < ConfigEntry > {
140
+ new ConfigEntry { Name = "consumer.session.timeout.ms" , Value = "50000" , IncrementalOperation = AlterConfigOpType . Set }
141
+ }
142
+ }
143
+ } ;
144
+ adminClient . IncrementalAlterConfigsAsync ( groupToUpdate ) . Wait ( ) ;
145
+ Thread . Sleep ( TimeSpan . FromMilliseconds ( 200 ) ) ;
146
+ var describeGroupConfigsResult = adminClient . DescribeConfigsAsync ( new List < ConfigResource > { groupConfigResource } ) . Result ;
147
+ Assert . Single ( describeGroupConfigsResult ) ;
148
+ Assert . Equal ( "50000" , describeGroupConfigsResult [ 0 ] . Entries [ "consumer.session.timeout.ms" ] . Value ) ;
149
+ LogToFile ( $ "Successfully updated consumer.group { groupName } config") ;
150
+ }
126
151
}
127
152
128
153
Assert . Equal ( 0 , Library . HandleCount ) ;
0 commit comments