MCPcopy
hub / github.com/etcd-io/etcd / TestMinSupportedVersion

Function TestMinSupportedVersion

client/v3/client_test.go:338–377  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

336}
337
338func TestMinSupportedVersion(t *testing.T) {
339 testutil.BeforeTest(t)
340 tests := []struct {
341 name string
342 currentVersion semver.Version
343 minSupportedVersion semver.Version
344 }{
345 {
346 name: "v3.6 client should accept v3.5",
347 currentVersion: version.V3_6,
348 minSupportedVersion: version.V3_5,
349 },
350 {
351 name: "v3.7 client should accept v3.6",
352 currentVersion: version.V3_7,
353 minSupportedVersion: version.V3_6,
354 },
355 {
356 name: "first minor version should accept its previous version",
357 currentVersion: version.V4_0,
358 minSupportedVersion: version.V3_7,
359 },
360 {
361 name: "first version in list should not accept previous versions",
362 currentVersion: version.V3_0,
363 minSupportedVersion: version.V3_0,
364 },
365 }
366
367 versionBackup := version.Version
368 t.Cleanup(func() {
369 version.Version = versionBackup
370 })
371 for _, tt := range tests {
372 t.Run(tt.name, func(t *testing.T) {
373 version.Version = tt.currentVersion.String()
374 require.True(t, minSupportedVersion().Equal(tt.minSupportedVersion))
375 })
376 }
377}
378
379func TestClientRejectOldCluster(t *testing.T) {
380 testutil.BeforeTest(t)

Callers

nothing calls this directly

Calls 6

minSupportedVersionFunction · 0.85
BeforeTestMethod · 0.65
CleanupMethod · 0.65
RunMethod · 0.65
StringMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…