(t *testing.T, nodeType string)
| 156 | } |
| 157 | |
| 158 | func 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 | |
| 182 | killRestore: |
| 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 { |
no test coverage detected