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

Function joinWhileVoteInProgress

ais/tests/multiproxy_test.go:551–604  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

549}
550
551func joinWhileVoteInProgress(t *testing.T) {
552 if docker.IsRunning() {
553 t.Skipf("skipping %s (docker is not supported)", t.Name())
554 }
555 var (
556 proxyURL = tutils.RandomProxyURL(t)
557 smap = tutils.GetClusterMap(t, proxyURL)
558 oldTargetCnt = smap.CountActiveTargets()
559 oldProxyCnt = smap.CountActiveProxies()
560 stopch = make(chan struct{})
561 errCh = make(chan error, 10)
562 mocktgt = &voteRetryMockTarget{
563 voteInProgress: true,
564 errCh: errCh,
565 }
566 )
567 tlog.Logf("targets: %d, proxies: %d\n", oldTargetCnt, oldProxyCnt)
568
569 go runMockTarget(t, proxyURL, mocktgt, stopch, smap)
570
571 _, err := tutils.WaitForClusterState(proxyURL, "synchronize on 'new mock target'",
572 smap.Version, oldProxyCnt, oldTargetCnt+1)
573 tassert.CheckFatal(t, err)
574
575 smap = killRestorePrimary(t, proxyURL, false, nil)
576 //
577 // FIXME: election is in progress if and only when xaction(apc.ActElection) is running -
578 // simulating the scenario via mocktgt.voteInProgress = true is incorrect
579 //
580 // if _, ok := smap.Pmap[oldPrimaryID]; ok {
581 // t.Fatalf("Previous primary proxy rejoined the cluster during a vote")
582 // }
583 mocktgt.voteInProgress = false
584 // smap, err = tutils.WaitForClusterState(newPrimaryURL, "synchronize new Smap",
585 // smap.Version, testing.Verbose(), oldProxyCnt, oldTargetCnt+1)
586 // tassert.CheckFatal(t, err)
587 //
588 // end of FIXME
589
590 // time to kill the mock target, job well done
591 var v struct{}
592 stopch <- v
593 close(stopch)
594 select {
595 case err := <-errCh:
596 t.Errorf("Mock Target Error: %v", err)
597
598 default:
599 }
600
601 _, err = tutils.WaitForClusterState(smap.Primary.URL(cmn.NetPublic),
602 "to kill mock target", smap.Version, oldProxyCnt, oldTargetCnt)
603 tassert.CheckFatal(t, err)
604}
605
606func minorityTargetMapVersionMismatch(t *testing.T) {
607 proxyURL := tutils.RandomProxyURL(t)

Callers

nothing calls this directly

Calls 12

IsRunningFunction · 0.92
RandomProxyURLFunction · 0.92
GetClusterMapFunction · 0.92
LogfFunction · 0.92
WaitForClusterStateFunction · 0.92
CheckFatalFunction · 0.92
runMockTargetFunction · 0.85
killRestorePrimaryFunction · 0.85
CountActiveTargetsMethod · 0.80
CountActiveProxiesMethod · 0.80
NameMethod · 0.65
URLMethod · 0.45

Tested by

no test coverage detected