package k8s_exec import ( "agent-go/utils" "fmt" "testing" "time" ) func TestCmiiK8sOperator_DeploymentAll(t *testing.T) { start := time.Now() deploymentList := CmiiOperator.DeploymentAll("devflight") elapsed := time.Since(start).Milliseconds() fmt.Printf("执行耗时: %d ms\n", elapsed) var nameList []string count := 1 for _, deployment := range deploymentList { if deployment.Spec.Replicas != nil { count++ } nameList = append(nameList, deployment.Name) } t.Logf("deployment list lenght is => %d", count) t.Logf("deployment name list are => %d", count) utils.BeautifulPrint(nameList) //for _, deployment := range deploymentList { // utils.BeautifulPrint(deployment) // println() //} } func TestCmiiK8sOperator_DeploymentAllInterface(t *testing.T) { start := time.Now() deploymentList := CmiiOperator.DeploymentAllInterface("devflight") elapsed := time.Since(start).Milliseconds() fmt.Printf("执行耗时: %d ms\n", elapsed) t.Logf("deployment list lenght is => %d", len(deploymentList)) for _, deployment := range deploymentList { utils.BeautifulPrint(deployment) println() } } func TestCmiiK8sOperator_DeploymentFizz(t *testing.T) { start := time.Now() deploymentFizz := CmiiOperator.DeploymentFizz("devflight", "") elapsed := time.Since(start).Milliseconds() fmt.Printf("执行耗时: %d ms\n", elapsed) t.Logf("deployment list lenght is => %d", len(deploymentFizz)) deploymentInterface := CmiiDeploymentInterface{} for _, pod := range deploymentFizz { convert := deploymentInterface.Convert(pod) utils.BeautifulPrint(convert) } // elastic search } func TestCmiiK8sOperator_DeploymentScale(t *testing.T) { start := time.Now() CmiiOperator.DeploymentScale("devflight", "cmii-uav-gis-server", 0) elapsed := time.Since(start).Milliseconds() fmt.Printf("执行耗时: %d ms\n", elapsed) } func TestCmiiK8sOperator_PodAll(t *testing.T) { start := time.Now() podList := CmiiOperator.PodAll("devflight") elapsed := time.Since(start).Milliseconds() fmt.Printf("执行耗时: %d ms\n", elapsed) for _, pod := range podList { println() utils.BeautifulPrint(pod) println() break } } func TestCmiiK8sOperator_PodFizz(t *testing.T) { start := time.Now() podList := CmiiOperator.PodFizz("devflight", "notice") elapsed := time.Since(start).Milliseconds() fmt.Printf("执行耗时: %d ms\n", elapsed) t.Logf("pod list lenght is => %d", len(podList)) for _, pod := range podList { println() utils.BeautifulPrint(pod) println() break } } func TestCmiiDeploymentInterface_Convert(t *testing.T) { log.DebugF("dadasdadasd") } func TestCmiiK8sOperator_PodFizz2(t *testing.T) { start := time.Now() podList := CmiiOperator.PodFizz("devflight", "notice") elapsed := time.Since(start).Milliseconds() fmt.Printf("执行耗时: %d ms\n", elapsed) t.Logf("pod list lenght is => %d", len(podList)) podInterface := CmiiPodInterface{} for _, pod := range podList { convert := podInterface.Convert(pod) println() utils.BeautifulPrint(&convert) println() } }