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

Function targetMapVersionMismatch

ais/tests/multiproxy_test.go:624–650  ·  view source on GitHub ↗

targetMapVersionMismatch updates map version of a few targets, kill the primary proxy wait for the new leader to come online

(getNum func(int) int, t *testing.T, proxyURL string)

Source from the content-addressed store, hash-verified

622// targetMapVersionMismatch updates map version of a few targets, kill the primary proxy
623// wait for the new leader to come online
624func targetMapVersionMismatch(getNum func(int) int, t *testing.T, proxyURL string) {
625 smap := tutils.GetClusterMap(t, proxyURL)
626 tlog.Logf("targets: %d, proxies: %d\n", smap.CountActiveTargets(), smap.CountActiveProxies())
627
628 smap.Version++
629 jsonMap, err := jsoniter.Marshal(smap)
630 tassert.CheckFatal(t, err)
631
632 n := getNum(smap.CountActiveTargets() + smap.CountActiveProxies() - 1)
633 for _, v := range smap.Tmap {
634 if n == 0 {
635 break
636 }
637 baseParams := tutils.BaseAPIParams(v.URL(cmn.NetPublic))
638 baseParams.Method = http.MethodPut
639 reqParams := &api.ReqParams{
640 BaseParams: baseParams,
641 Path: apc.URLPathDae.Join(apc.SyncSmap),
642 Body: jsonMap,
643 Header: http.Header{cos.HdrContentType: []string{cos.ContentJSON}},
644 }
645 err = reqParams.DoHTTPRequest()
646 tassert.CheckFatal(t, err)
647 n--
648 }
649 killRestorePrimary(t, proxyURL, false, nil)
650}
651
652// concurrentPutGetDel does put/get/del sequence against all proxies concurrently
653func concurrentPutGetDel(t *testing.T) {

Calls 11

DoHTTPRequestMethod · 0.95
GetClusterMapFunction · 0.92
LogfFunction · 0.92
CheckFatalFunction · 0.92
BaseAPIParamsFunction · 0.92
killRestorePrimaryFunction · 0.85
CountActiveTargetsMethod · 0.80
CountActiveProxiesMethod · 0.80
MarshalMethod · 0.80
JoinMethod · 0.80
URLMethod · 0.45

Tested by

no test coverage detected