MCPcopy
hub / github.com/IBM/sarama / versionRange

Function versionRange

functional_consumer_test.go:501–527  ·  view source on GitHub ↗
(lower KafkaVersion)

Source from the content-addressed store, hash-verified

499}
500
501func versionRange(lower KafkaVersion) []KafkaVersion {
502 // Get the test cluster version from the environment. If there is nothing
503 // there then assume the highest.
504 upper, err := ParseKafkaVersion(os.Getenv("KAFKA_VERSION"))
505 if err != nil {
506 upper = MaxVersion
507 }
508
509 // KIP-896 dictates a minimum lower bound of 2.1 protocol for Kafka 4.0 onwards
510 if upper.IsAtLeast(V4_0_0_0) {
511 if !lower.IsAtLeast(V2_1_0_0) {
512 lower = V2_1_0_0
513 }
514 }
515
516 versions := make([]KafkaVersion, 0, len(fvtRangeVersions))
517 for _, v := range fvtRangeVersions {
518 if !v.IsAtLeast(lower) {
519 continue
520 }
521 if !upper.IsAtLeast(v) {
522 return versions
523 }
524 versions = append(versions, v)
525 }
526 return versions
527}
528
529func produceMsgs(t *testing.T, clientVersions []KafkaVersion, codecs []CompressionCodec, flush int, countPerVerCodec int, idempotent bool) []*ProducerMessage {
530 var (

Callers 4

TestVersionMatrixFunction · 0.85
TestVersionMatrixLZ4Function · 0.85
TestVersionMatrixZstdFunction · 0.85

Calls 2

ParseKafkaVersionFunction · 0.85
IsAtLeastMethod · 0.80

Tested by

no test coverage detected