@Override
    public void updateHealthStatusForPersistentInstance(String namespace, String fullServiceName, String clusterName,
            String ip, int port, boolean healthy) throws NacosException {
        String groupName = NamingUtils.getGroupName(fullServiceName);
        String serviceName = NamingUtils.getServiceName(fullServiceName);
        Service service = Service.newService(namespace, groupName, serviceName);
        Optional<ServiceMetadata> serviceMetadata = metadataManager.getServiceMetadata(service);
        if (!serviceMetadata.isPresent() || !serviceMetadata.get().getClusters().containsKey(clusterName)) {
            throwHealthCheckerException(fullServiceName, clusterName);
        }
        ClusterMetadata clusterMetadata = serviceMetadata.get().getClusters().get(clusterName);
        if (!HealthCheckType.NONE.name().equals(clusterMetadata.getHealthyCheckType())) {
            throwHealthCheckerException(fullServiceName, clusterName);
        }
        String clientId = IpPortBasedClient.getClientId(ip + InternetAddressUtil.IP_PORT_SPLITER + port, false);
        Client client = clientManager.getClient(clientId);
        if (null == client) {
            return;
        }
        InstancePublishInfo oldInstance = client.getInstancePublishInfo(service);
        if (null == oldInstance) {
            return;
        }
        Instance newInstance = InstanceUtil.parseToApiInstance(service, oldInstance);
        newInstance.setHealthy(healthy);
        clientOperationService.registerInstance(service, newInstance, clientId);
    }
@Test
    void testUpdateHealthStatusForPersistentInstance() {
        try {
            ServiceMetadata metadata = new ServiceMetadata();
            Map<String, ClusterMetadata> clusterMap = new HashMap<>(2);
            ClusterMetadata cluster = Mockito.mock(ClusterMetadata.class);
            clusterMap.put("C", cluster);
            metadata.setClusters(clusterMap);
            Instance instance = new Instance();
            instance.setIp("1.1.1.1");
            instance.setPort(8080);
            Mockito.when(cluster.getHealthyCheckType()).thenReturn(HealthCheckType.NONE.name());
            Mockito.when(metadataManager.getServiceMetadata(Mockito.any())).thenReturn(Optional.of(metadata));
            
            ConnectionBasedClient client = Mockito.mock(ConnectionBasedClient.class);
            Mockito.when(clientManager.getClient(Mockito.anyString())).thenReturn(client);
            
            InstancePublishInfo instancePublishInfo = new InstancePublishInfo();
            instancePublishInfo.setExtendDatum(new HashMap<>(2));
            Mockito.when(client.getInstancePublishInfo(Mockito.any())).thenReturn(instancePublishInfo);
            
            healthOperatorV2.updateHealthStatusForPersistentInstance("A", "B", "C", "1.1.1.1", 8080, true);
        } catch (NacosException e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
    }