refactor(接口测试): 修改 pod 选择条件

This commit is contained in:
fit2-zhao 2024-10-11 12:41:48 +08:00 committed by Craftsman
parent c16d276441
commit 0672393488
1 changed files with 2 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.JSON;
import io.metersphere.sdk.util.LogUtils; import io.metersphere.sdk.util.LogUtils;
import io.metersphere.system.dto.pool.TestResourceDTO; import io.metersphere.system.dto.pool.TestResourceDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
@ -36,7 +37,7 @@ public class KubernetesProvider {
.inNamespace(credential.getNamespace()) .inNamespace(credential.getNamespace())
.list().getItems() .list().getItems()
.stream() .stream()
.filter(s -> RUNNING_PHASE.equals(s.getStatus().getPhase())) .filter(s -> RUNNING_PHASE.equals(s.getStatus().getPhase()) && StringUtils.startsWith(s.getMetadata().getGenerateName(), "task-runner"))
.toList(); .toList();
if (CollectionUtils.isEmpty(nodePods)) { if (CollectionUtils.isEmpty(nodePods)) {