diff --git a/pkg/kversion/kversion.go b/pkg/kversion/kversion.go index 8aa6ffb4..46c2a4dd 100644 --- a/pkg/kversion/kversion.go +++ b/pkg/kversion/kversion.go @@ -201,14 +201,6 @@ type guessOpt struct{ fn func(*guessCfg) } func (opt guessOpt) apply(cfg *guessCfg) { opt.fn(cfg) } // SkipKeys skips the given keys while guessing versions. -// -// The current default is to skip keys that are only used by brokers: -// -// 4: LeaderAndISR -// 5: StopReplica -// 6: UpdateMetadata -// 7: ControlledShutdown -// 27: WriteTxnMarkers func SkipKeys(keys ...int16) VersionGuessOpt { return guessOpt{func(cfg *guessCfg) { cfg.skipKeys = keys }} } @@ -337,7 +329,7 @@ func (vs *Versions) versionGuess(opts ...VersionGuessOpt) guess { // // TODO: add introduced-version to differentiate some specific // keys. - skipKeys: []int16{4, 5, 6, 7, 27, 58}, + skipKeys: []int16{4, 5, 6, 7, 27, 52, 53, 54, 55, 56, 57, 58, 59, 62, 63, 64, 67}, } for _, opt := range opts { opt.apply(&cfg) diff --git a/pkg/kversion/kversion_test.go b/pkg/kversion/kversion_test.go index 57b8eb86..3574aa25 100644 --- a/pkg/kversion/kversion_test.go +++ b/pkg/kversion/kversion_test.go @@ -221,3 +221,42 @@ func TestFromString(t *testing.T) { } } } + +func TestGuessVersions(t *testing.T) { + for _, test := range []struct { + vs *Versions + exp string + }{ + {V0_8_0(), "v0.8.0"}, + {V0_8_1(), "v0.8.1"}, + {V0_8_2(), "v0.8.2"}, + {V0_9_0(), "v0.9.0"}, + {V0_10_0(), "v0.10.0"}, + {V0_10_1(), "v0.10.1"}, + {V0_10_2(), "v0.10.2"}, + {V0_11_0(), "v0.11.0"}, + {V1_0_0(), "v1.0"}, + {V1_1_0(), "v1.1"}, + {V2_0_0(), "v2.0"}, + {V2_1_0(), "v2.1"}, + {V2_2_0(), "v2.2"}, + {V2_3_0(), "v2.3"}, + {V2_4_0(), "v2.4"}, + {V2_5_0(), "v2.5"}, + {V2_6_0(), "v2.6"}, + {V2_7_0(), "v2.7"}, + {V2_8_0(), "v2.8"}, + {V3_0_0(), "v3.0"}, + {V3_1_0(), "v3.1"}, + {V3_2_0(), "v3.2"}, + {V3_3_0(), "v3.3"}, + {V3_4_0(), "v3.4"}, + {V3_5_0(), "v3.5"}, + {V3_6_0(), "v3.6"}, + } { + got := test.vs.VersionGuess() + if got != test.exp { + t.Errorf("got %s != exp %s", got, test.exp) + } + } +}