MCPcopy
hub / github.com/NVIDIA/aistore / targetRejoin

Function targetRejoin

ais/tests/multiproxy_test.go:481–515  ·  view source on GitHub ↗

targetRejoin kills a random selected target, wait for it to rejoin and verifies it

(t *testing.T)

Source from the content-addressed store, hash-verified

479
480// targetRejoin kills a random selected target, wait for it to rejoin and verifies it
481func targetRejoin(t *testing.T) {
482 var (
483 id string
484 node *cluster.Snode
485 proxyURL = tutils.RandomProxyURL(t)
486 )
487
488 smap := tutils.GetClusterMap(t, proxyURL)
489 tlog.Logf("targets: %d, proxies: %d\n", smap.CountActiveTargets(), smap.CountActiveProxies())
490
491 node, _ = smap.GetRandTarget()
492 id = node.ID()
493
494 cmd, err := tutils.KillNode(node)
495 tassert.CheckFatal(t, err)
496 smap, err = tutils.WaitForClusterState(proxyURL, "synchronize on 'target crashed'",
497 smap.Version, smap.CountActiveProxies(), smap.CountActiveTargets()-1)
498 tassert.CheckFatal(t, err)
499
500 if _, ok := smap.Tmap[id]; ok {
501 t.Fatalf("Killed target was not removed from the Smap: %v", id)
502 }
503
504 err = tutils.RestoreNode(cmd, false, "target")
505 tassert.CheckFatal(t, err)
506
507 smap, err = tutils.WaitForClusterState(proxyURL, "synchronize on 'target rejoined'",
508 smap.Version, smap.CountActiveProxies(), smap.CountActiveTargets()+1)
509 tassert.CheckFatal(t, err)
510
511 if _, ok := smap.Tmap[id]; !ok {
512 t.Fatalf("Restarted target %s did not rejoin the cluster", id)
513 }
514 tutils.WaitForRebalAndResil(t, tutils.BaseAPIParams(proxyURL))
515}
516
517// crashAndFastRestore kills the primary and restores it before a new leader is elected
518func crashAndFastRestore(t *testing.T) {

Callers

nothing calls this directly

Calls 13

RandomProxyURLFunction · 0.92
GetClusterMapFunction · 0.92
LogfFunction · 0.92
KillNodeFunction · 0.92
CheckFatalFunction · 0.92
WaitForClusterStateFunction · 0.92
RestoreNodeFunction · 0.92
WaitForRebalAndResilFunction · 0.92
BaseAPIParamsFunction · 0.92
CountActiveTargetsMethod · 0.80
CountActiveProxiesMethod · 0.80
GetRandTargetMethod · 0.80

Tested by

no test coverage detected