This commit is contained in:
Captain.B 2020-04-22 10:03:33 +08:00
parent 68ad0c54d9
commit ad26dc0c65
1 changed files with 4 additions and 2 deletions

View File

@ -133,8 +133,10 @@ public class KubernetesTestEngine extends AbstractEngine {
ClientCredential clientCredential = JSON.parseObject(configuration, ClientCredential.class); ClientCredential clientCredential = JSON.parseObject(configuration, ClientCredential.class);
KubernetesProvider provider = new KubernetesProvider(JSON.toJSONString(clientCredential)); KubernetesProvider provider = new KubernetesProvider(JSON.toJSONString(clientCredential));
provider.confirmNamespace(loadTest.getProjectId()); provider.confirmNamespace(loadTest.getProjectId());
String joblog = provider.getKubernetesClient().batch().jobs().inNamespace(loadTest.getProjectId()).withName("job-" + loadTest.getId()).getLog(); try (KubernetesClient client = provider.getKubernetesClient()) {
logs.put(clientCredential.getMasterUrl(), joblog); String joblog = client.batch().jobs().inNamespace(loadTest.getProjectId()).withName("job-" + loadTest.getId()).getLog();
logs.put(clientCredential.getMasterUrl(), joblog);
}
} catch (Exception e) { } catch (Exception e) {
MSException.throwException(e); MSException.throwException(e);
} }