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

Function killRestoreDiffIP

ais/tests/multiproxy_test.go:158–226  ·  view source on GitHub ↗
(t *testing.T, nodeType string)

Source from the content-addressed store, hash-verified

156}
157
158func killRestoreDiffIP(t *testing.T, nodeType string) {
159 // NOTE: This function requires local deployment as it changes node config
160 tutils.CheckSkip(t, tutils.SkipTestArgs{RequiredDeployment: tutils.ClusterTypeLocal})
161
162 var (
163 proxyURL = tutils.GetPrimaryURL()
164 smap = tutils.GetClusterMap(t, proxyURL)
165 origProxyCnt, origTargetCount = smap.CountActiveProxies(), smap.CountActiveTargets()
166 portInc = 100
167 node *cluster.Snode
168 err error
169 pdc, tdc int
170 restore bool
171 )
172
173 if nodeType == apc.Proxy {
174 node, err = smap.GetRandProxy(true /*exclude primary*/)
175 pdc = 1
176 } else {
177 node, err = smap.GetRandTarget()
178 tdc = 1
179 }
180 tassert.CheckFatal(t, err)
181
182killRestore:
183 cfg := tutils.GetDaemonConfig(t, node)
184 tlog.Logf("Killing %s\n", node.StringEx())
185 cmd, err := tutils.KillNode(node)
186 tassert.CheckFatal(t, err)
187
188 smap, err = tutils.WaitForClusterState(proxyURL, "kill primary", smap.Version, origProxyCnt-pdc, origTargetCount-tdc)
189 tassert.CheckFatal(t, err)
190
191 // Update local config ports.
192 localConfPath := filepath.Join(cfg.ConfigDir, fname.PlaintextInitialConfig)
193 localConf := &cmn.LocalConfig{}
194 _, err = jsp.LoadMeta(localConfPath, localConf)
195 tassert.CheckFatal(t, err)
196 localConf.HostNet.Port = cfg.HostNet.Port + portInc
197 localConf.HostNet.PortIntraControl = cfg.HostNet.PortIntraControl + portInc
198 localConf.HostNet.PortIntraData = cfg.HostNet.PortIntraData + portInc
199 err = jsp.SaveMeta(localConfPath, localConf, nil)
200 tassert.CheckFatal(t, err)
201
202 err = tutils.RestoreNode(cmd, false, nodeType)
203 tassert.CheckFatal(t, err)
204
205 smap, err = tutils.WaitForClusterState(proxyURL, "restore with changed config", smap.Version, origProxyCnt, 0)
206 tassert.CheckFatal(t, err)
207
208 // Health check with old public URL should fail
209 err = api.Health(tutils.BaseAPIParams(node.URL(cmn.NetPublic)))
210 tassert.Errorf(t, err != nil, "health check with old IP information should fail %v", err)
211
212 newNode := smap.GetNode(node.ID())
213 err = tutils.WaitNodeReady(newNode.URL(cmn.NetPublic))
214 tassert.CheckError(t, err)
215 if !restore {

Callers 1

Calls 15

CheckSkipFunction · 0.92
GetPrimaryURLFunction · 0.92
GetClusterMapFunction · 0.92
CheckFatalFunction · 0.92
GetDaemonConfigFunction · 0.92
LogfFunction · 0.92
KillNodeFunction · 0.92
WaitForClusterStateFunction · 0.92
LoadMetaFunction · 0.92
SaveMetaFunction · 0.92
RestoreNodeFunction · 0.92
HealthFunction · 0.92

Tested by

no test coverage detected