package nju.seec.SEECdemo.service.api; import nju.seec.SEECdemo.logic.api.k8s.ExecApi; import nju.seec.SEECdemo.logic.api.k8s.exception.K8sApiException; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.ArrayList; import java.util.List; @RunWith(SpringRunner.class) @SpringBootTest public class ExecApiImplTest { @Autowired private ExecApi execApi; @Test public void testExec(){ List commands = new ArrayList<>(); commands.add("sh"); commands.add("-c"); commands.add("mysql -u root -ppassword -e 'drop if exists java; create database java;'"); try { execApi.exec("group24", "mysql-7b688cf578-l7pxs", commands); } catch (K8sApiException e) { e.printStackTrace(); } } }