[agent-operator] - update dltu part

This commit is contained in:
zeaslity
2024-04-26 17:51:11 +08:00
parent 318a5a8026
commit 021690f5c4
12 changed files with 338 additions and 197 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"fmt"
"strconv"
"testing"
"time"
"wdd.io/agent-common/assert"
@@ -110,7 +111,7 @@ func TestFindPodNotHealthy_And_Delete(t *testing.T) {
for _, podInterface := range podNotHealthy {
t.Logf("[%s] [%s]", podInterface.Name, podInterface.PodPhase)
podDelete := CmiiOperator.PodDelete(podInterface.Namespace, podInterface.Name)
podDelete := DefaultCmiiOperator.PodDelete(podInterface.Namespace, podInterface.Name)
assert.Equal(t, podDelete, true, "delete of ", podInterface.Namespace, podInterface.Name, " failed !")
}
@@ -118,12 +119,12 @@ func TestFindPodNotHealthy_And_Delete(t *testing.T) {
}
func TestFilterAllCmiiAppStrict(t *testing.T) {
allInterface := CmiiOperator.DeploymentAllInterface("devflight")
allInterface := DefaultCmiiOperator.DeploymentAllInterface("devflight")
FilterAllCmiiAppStrict(allInterface)
}
func TestRestartDeploymentFromList(t *testing.T) {
allInterface := CmiiOperator.DeploymentAllInterface("devflight")
allInterface := DefaultCmiiOperator.DeploymentAllInterface("devflight")
allInterface = FilterAllCmiiAppSoft(allInterface)
RestartDeploymentFromList(allInterface)
@@ -240,10 +241,10 @@ func TestRestartCmiiDeployment(t *testing.T) {
cmiiEnv := integration
appName := "cmii-uav-platform"
kill := CmiiOperator.DeploymentRestartByKill(cmiiEnv, appName)
kill := DefaultCmiiOperator.DeploymentRestartByKill(cmiiEnv, appName)
assert.Equal(t, kill, true, "have unhealthy pod !")
check := CmiiOperator.DeploymentStatusCheck(cmiiEnv, appName, 180)
check := DefaultCmiiOperator.DeploymentStatusCheck(cmiiEnv, appName, 180)
assert.Equal(t, check, true, "DeploymentStatusCheck failed !")
}
@@ -278,20 +279,22 @@ func TestUpdateCmiiDeploymentImageTag(t *testing.T) {
}
for appName, newTag := range appNameTagMap {
tag := UpdateCmiiDeploymentImageTag(cmiiEnv, appName, newTag)
assert.Equal(t, tag, true, "update image tag failed !")
ok, oldImageTag, newImageTag := UpdateCmiiDeploymentImageTag(cmiiEnv, appName, newTag)
assert.Equal(t, ok, true, "update image tag failed !")
utils.SplitLinePrint()
check := CmiiOperator.DeploymentStatusCheck(cmiiEnv, appName, 300)
check := DefaultCmiiOperator.DeploymentStatusCheck(cmiiEnv, appName, 300)
assert.Equal(t, check, true, "deployment run failed!")
deploy := DefaultCmiiOperator.DeploymentOneInterface(cmiiEnv, appName)
// push message
message := pusher.CmiiUpdateMessage{
Namespace: cmiiEnv,
AppName: appName,
FromTag: "",
ToTag: newTag,
Replicas: "",
FromTag: oldImageTag,
ToTag: newImageTag,
Replicas: strconv.FormatInt(int64(deploy.Replicas), 10),
DeployStatus: check,
}
message.SendMessage()