File: api_versions_response_test.go

package info (click to toggle)
golang-github-shopify-sarama 1.22.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,728 kB
  • sloc: sh: 112; makefile: 43
file content (32 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package sarama

import "testing"

var (
	apiVersionResponse = []byte{
		0x00, 0x00,
		0x00, 0x00, 0x00, 0x01,
		0x00, 0x03,
		0x00, 0x02,
		0x00, 0x01,
	}
)

func TestApiVersionsResponse(t *testing.T) {
	var response *ApiVersionsResponse

	response = new(ApiVersionsResponse)
	testVersionDecodable(t, "no error", response, apiVersionResponse, 0)
	if response.Err != ErrNoError {
		t.Error("Decoding error failed: no error expected but found", response.Err)
	}
	if response.ApiVersions[0].ApiKey != 0x03 {
		t.Error("Decoding error: expected 0x03 but got", response.ApiVersions[0].ApiKey)
	}
	if response.ApiVersions[0].MinVersion != 0x02 {
		t.Error("Decoding error: expected 0x02 but got", response.ApiVersions[0].MinVersion)
	}
	if response.ApiVersions[0].MaxVersion != 0x01 {
		t.Error("Decoding error: expected 0x01 but got", response.ApiVersions[0].MaxVersion)
	}
}