25
25
0 , // Sensitive
26
26
}
27
27
28
+ describeConfigsResponseWithDefaultv0 = []byte {
29
+ 0 , 0 , 0 , 0 , //throttle
30
+ 0 , 0 , 0 , 1 , // response
31
+ 0 , 0 , //errorcode
32
+ 0 , 0 , //string
33
+ 2 , // topic
34
+ 0 , 3 , 'f' , 'o' , 'o' ,
35
+ 0 , 0 , 0 , 1 , //configs
36
+ 0 , 10 , 's' , 'e' , 'g' , 'm' , 'e' , 'n' , 't' , '.' , 'm' , 's' ,
37
+ 0 , 4 , '1' , '0' , '0' , '0' ,
38
+ 0 , // ReadOnly
39
+ 1 , // Default
40
+ 0 , // Sensitive
41
+ }
42
+
28
43
describeConfigsResponsePopulatedv1 = []byte {
29
44
0 , 0 , 0 , 0 , //throttle
30
45
0 , 0 , 0 , 1 , // response
59
74
0 , 4 , '1' , '0' , '0' , '0' ,
60
75
4 , // Source
61
76
}
77
+
78
+ describeConfigsResponseWithDefaultv1 = []byte {
79
+ 0 , 0 , 0 , 0 , //throttle
80
+ 0 , 0 , 0 , 1 , // response
81
+ 0 , 0 , //errorcode
82
+ 0 , 0 , //string
83
+ 2 , // topic
84
+ 0 , 3 , 'f' , 'o' , 'o' ,
85
+ 0 , 0 , 0 , 1 , //configs
86
+ 0 , 10 , 's' , 'e' , 'g' , 'm' , 'e' , 'n' , 't' , '.' , 'm' , 's' ,
87
+ 0 , 4 , '1' , '0' , '0' , '0' ,
88
+ 0 , // ReadOnly
89
+ 5 , // Source
90
+ 0 , // Sensitive
91
+ 0 , 0 , 0 , 0 , // No Synonym
92
+ }
62
93
)
63
94
64
95
func TestDescribeConfigsResponsev0 (t * testing.T ) {
@@ -86,6 +117,7 @@ func TestDescribeConfigsResponsev0(t *testing.T) {
86
117
ReadOnly : false ,
87
118
Default : false ,
88
119
Sensitive : false ,
120
+ Source : SourceUnknown ,
89
121
},
90
122
},
91
123
},
@@ -94,6 +126,40 @@ func TestDescribeConfigsResponsev0(t *testing.T) {
94
126
testResponse (t , "response with error" , response , describeConfigsResponsePopulatedv0 )
95
127
}
96
128
129
+ func TestDescribeConfigsResponseWithDefaultv0 (t * testing.T ) {
130
+ var response * DescribeConfigsResponse
131
+
132
+ response = & DescribeConfigsResponse {
133
+ Resources : []* ResourceResponse {},
134
+ }
135
+ testVersionDecodable (t , "empty" , response , describeConfigsResponseEmpty , 0 )
136
+ if len (response .Resources ) != 0 {
137
+ t .Error ("Expected no groups" )
138
+ }
139
+
140
+ response = & DescribeConfigsResponse {
141
+ Version : 0 , Resources : []* ResourceResponse {
142
+ {
143
+ ErrorCode : 0 ,
144
+ ErrorMsg : "" ,
145
+ Type : TopicResource ,
146
+ Name : "foo" ,
147
+ Configs : []* ConfigEntry {
148
+ {
149
+ Name : "segment.ms" ,
150
+ Value : "1000" ,
151
+ ReadOnly : false ,
152
+ Default : true ,
153
+ Sensitive : false ,
154
+ Source : SourceDefault ,
155
+ },
156
+ },
157
+ },
158
+ },
159
+ }
160
+ testResponse (t , "response with default" , response , describeConfigsResponseWithDefaultv0 )
161
+ }
162
+
97
163
func TestDescribeConfigsResponsev1 (t * testing.T ) {
98
164
var response * DescribeConfigsResponse
99
165
@@ -119,6 +185,7 @@ func TestDescribeConfigsResponsev1(t *testing.T) {
119
185
Value : "1000" ,
120
186
ReadOnly : false ,
121
187
Source : SourceStaticBroker ,
188
+ Default : false ,
122
189
Sensitive : false ,
123
190
Synonyms : []* ConfigSynonym {},
124
191
},
@@ -154,6 +221,7 @@ func TestDescribeConfigsResponseWithSynonym(t *testing.T) {
154
221
Value : "1000" ,
155
222
ReadOnly : false ,
156
223
Source : SourceStaticBroker ,
224
+ Default : false ,
157
225
Sensitive : false ,
158
226
Synonyms : []* ConfigSynonym {
159
227
{
@@ -169,3 +237,39 @@ func TestDescribeConfigsResponseWithSynonym(t *testing.T) {
169
237
}
170
238
testResponse (t , "response with error" , response , describeConfigsResponseWithSynonymv1 )
171
239
}
240
+
241
+ func TestDescribeConfigsResponseWithDefaultv1 (t * testing.T ) {
242
+ var response * DescribeConfigsResponse
243
+
244
+ response = & DescribeConfigsResponse {
245
+ Resources : []* ResourceResponse {},
246
+ }
247
+ testVersionDecodable (t , "empty" , response , describeConfigsResponseEmpty , 0 )
248
+ if len (response .Resources ) != 0 {
249
+ t .Error ("Expected no groups" )
250
+ }
251
+
252
+ response = & DescribeConfigsResponse {
253
+ Version : 1 ,
254
+ Resources : []* ResourceResponse {
255
+ {
256
+ ErrorCode : 0 ,
257
+ ErrorMsg : "" ,
258
+ Type : TopicResource ,
259
+ Name : "foo" ,
260
+ Configs : []* ConfigEntry {
261
+ {
262
+ Name : "segment.ms" ,
263
+ Value : "1000" ,
264
+ ReadOnly : false ,
265
+ Source : SourceDefault ,
266
+ Default : true ,
267
+ Sensitive : false ,
268
+ Synonyms : []* ConfigSynonym {},
269
+ },
270
+ },
271
+ },
272
+ },
273
+ }
274
+ testResponse (t , "response with error" , response , describeConfigsResponseWithDefaultv1 )
275
+ }
0 commit comments