Skip to content

Commit

Permalink
Accept HALTING app state in addition to (now legacy) PURGING and REST…
Browse files Browse the repository at this point in the history
…ARTING states

This commit makes eden compatible not only with the latest EVE releases,
but also with the 12.0 LTS version.
  • Loading branch information
milan-zededa authored and uncleDecart committed Aug 6, 2024
1 parent 90aead8 commit 3233e4a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
5 changes: 3 additions & 2 deletions pkg/openevec/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,9 @@ func (openEVEC *OpenEVEC) PodModify(appName string, podNetworks, portPublish, ac
if needPurge {
processingFunction := func(im *info.ZInfoMsg) bool {
if im.Ztype == info.ZInfoTypes_ZiApp {
// waiting for halting state
if im.GetAinfo().State == info.ZSwState_HALTING {
// waiting for purging or halting state
if im.GetAinfo().State == info.ZSwState_PURGING ||
im.GetAinfo().State == info.ZSwState_HALTING {
return true
}
}
Expand Down
7 changes: 7 additions & 0 deletions tests/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ func checkNewLastState(appName, state string) bool {
appStates, ok := states[appName]
if ok {
lastState := appStates[len(appStates)-1]
// PURGING and RESTARTING are not published by EVE since 12.3
if state == "PURGING" || state == "RESTARTING" {
if lastState.state == "HALTING" {
// The expected state was reached.
return false
}
}
if lastState.state != state {
return true
}
Expand Down
2 changes: 1 addition & 1 deletion tests/eclient/testdata/app_dns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ stdout 'Address:\s*172.26.11.1'
# Repeat DNS resolution tests after purging (we had bugs affecting this scenario).
message 'Purging app1'
eden pod purge app1
test eden.app.test -test.v -timewait 5m HALTING app1
test eden.app.test -test.v -timewait 5m PURGING app1
test eden.app.test -test.v -timewait 5m RUNNING app1

message 'Re-checking accessibility after purge of app1'
Expand Down
10 changes: 5 additions & 5 deletions tests/eclient/testdata/app_local_info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exec -t 1m bash get-appinfo-status.sh app1
! stdout 'lastCmdTimestamp'
! stderr .
exec -t 1m bash put-appinfo-cmd.sh app1 123 COMMAND_PURGE &
exec -t 5m bash wait-for-app-state.sh app1 HALTING
exec -t 5m bash wait-for-app-state.sh app1 "PURGING|HALTING"
exec -t 5m bash wait-for-app-state.sh app1 RUNNING
exec -t 5m bash wait-for-volume.sh app1
stdout DELIVERED
Expand All @@ -92,7 +92,7 @@ exec -t 5m bash wait-ssh.sh {{template "app_port"}}
# Note that eve sums local and remote purge counters.
exec -t 1m bash create-file-in-app1.sh /root/purge_test
eden pod purge app1
exec -t 5m bash wait-for-app-state.sh app1 HALTING
exec -t 5m bash wait-for-app-state.sh app1 "PURGING|HALTING"
exec -t 5m bash wait-for-app-state.sh app1 RUNNING
exec -t 5m bash wait-for-volume.sh app1
stdout DELIVERED
Expand All @@ -109,7 +109,7 @@ exec -t 5m bash wait-ssh.sh {{template "app_port"}}
exec -t 1m bash create-file-in-app1.sh /run/restart_test
exec -t 1m bash create-file-in-app1.sh /root/purge_test
exec -t 1m bash put-appinfo-cmd.sh app1 456 COMMAND_RESTART &
exec -t 5m bash wait-for-app-state.sh app1 HALTING
exec -t 5m bash wait-for-app-state.sh app1 "RESTARTING|HALTING"
exec -t 5m bash wait-for-app-state.sh app1 RUNNING
exec -t 1m bash get-appinfo-status.sh app1
stdout '"lastCmdTimestamp": "456"'
Expand All @@ -123,7 +123,7 @@ exec -t 1m bash file-exists-in-app1.sh /root/purge_test
exec -t 1m bash create-file-in-app1.sh /run/restart_test
exec -t 1m bash create-file-in-app1.sh /root/purge_test
eden pod restart app1
exec -t 5m bash wait-for-app-state.sh app1 HALTING
exec -t 5m bash wait-for-app-state.sh app1 "RESTARTING|HALTING"
exec -t 5m bash wait-for-app-state.sh app1 RUNNING
exec -t 1m bash get-appinfo-status.sh app1
stdout '"lastCmdTimestamp": "456"'
Expand Down Expand Up @@ -212,7 +212,7 @@ EDEN={{EdenConfig "eden.root"}}/{{EdenConfig "eden.bin-dist"}}/{{EdenConfig "ede
while true; do
APPINFO="$($EDEN sdn fwd eth0 {{template "mngr_port"}} -- {{template "ssh"}} "cat {{template "app_info_status_file"}}")"
APPINFO="$(echo "$APPINFO" | jq --arg APP "$APP" '.appsInfo[] | select(.name==$APP)')"
echo "$APPINFO" | grep "$EXPSTATE" && break
echo "$APPINFO" | grep -E "$EXPSTATE" && break
sleep 1
done

Expand Down
2 changes: 1 addition & 1 deletion tests/volume/testdata/volumes_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ exec sleep 10

# check purging of app with large volume
eden pod purge eclient-mount
test eden.app.test -test.v -timewait 2m HALTING eclient-mount
test eden.app.test -test.v -timewait 2m PURGING eclient-mount
test eden.app.test -test.v -timewait 10m RUNNING eclient-mount

exec sleep 10
Expand Down

0 comments on commit 3233e4a

Please sign in to comment.