-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get latest version supported for DescribeConfigsRequest
- Loading branch information
Showing
2 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package kafka | ||
|
||
import "testing" | ||
|
||
func Test_ClientAPIVersion(t *testing.T) { | ||
// Default to 0 | ||
client := &Client{} | ||
maxVersion := client.versionForKey(32, 1) | ||
if maxVersion != 0 { | ||
t.Errorf("Got %d, expected %d", maxVersion, 0) | ||
} | ||
|
||
// use the max version the broker supports, if it's less than the requested | ||
// version | ||
client.supportedAPIs = map[int]int{32: 0} | ||
maxVersion = client.versionForKey(32, 1) | ||
if maxVersion != 0 { | ||
t.Errorf("Got %d, expected %d", maxVersion, 0) | ||
} | ||
|
||
// while the broker supports 2, terraform-provider-kafka only supports 1, so | ||
// use that | ||
client.supportedAPIs = map[int]int{32: 2} | ||
maxVersion = client.versionForKey(32, 1) | ||
if maxVersion != 1 { | ||
t.Errorf("Got %d, expected %d", maxVersion, 1) | ||
} | ||
} |