[ Agent ] [ CMII ] - 新增大量功能

This commit is contained in:
zeaslity
2024-01-10 15:11:41 +08:00
parent 22faf15665
commit 7ce838289b
10 changed files with 879 additions and 36 deletions

View File

@@ -2,6 +2,7 @@ package k8s_exec
import (
"agent-go/utils"
"github.com/magiconair/properties/assert"
"testing"
)
@@ -17,7 +18,42 @@ func TestFindDeploymentRestartCountGreaterThanN(t *testing.T) {
}
func TestGetCmiiAllDeploymentFromDemo(t *testing.T) {
func TestFindDeploymentReplicasSmallerThanN(t *testing.T) {
deploymentReplicasSmallerThanN := FindDeploymentReplicasSmallerThanN("devflight", 0)
for _, deploymentInterface := range deploymentReplicasSmallerThanN {
println()
utils.BeautifulPrint(deploymentInterface)
println()
}
GetCmiiAllDeploymentFromDemo()
}
func TestGetCmiiAllDeploymentFromEnv(t *testing.T) {
BackupAllDeploymentFromEnv("uat")
}
func TestBackupAllCmiiDeploymentToMap(t *testing.T) {
backendMap, frontendMap := BackupAllCmiiDeploymentToMap("demo")
utils.BeautifulPrint(backendMap)
utils.BeautifulPrint(frontendMap)
}
func TestUpdateCmiiDeploymentImageTag(t *testing.T) {
//tag := UpdateCmiiDeploymentImageTag("devflight", "cmii-uav-depotautoreturn", "123sdsa45678")
tag := UpdateCmiiDeploymentImageTag("demo", "cmii-uav-platform", "5.2.0-011004")
assert.Equal(t, tag, true, "update image tag failed !")
}
func TestRollBackCmiiDeploymentFromUpdateLog(t *testing.T) {
updateLog := RollBackCmiiDeploymentFromUpdateLog("2024-01-10-14-37-07 uavcloud-devflight cmii-uav-depotautoreturn 12345678 123sdsa45678")
assert.Equal(t, updateLog, true, "roll back from update log failed !")
}