Skip to content

Commit

Permalink
Failed update tests
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Sadov <[email protected]>
  • Loading branch information
zed-sadov committed Mar 23, 2021
1 parent 8bbddc3 commit 0c57f6f
Show file tree
Hide file tree
Showing 2 changed files with 167 additions and 0 deletions.
89 changes: 89 additions & 0 deletions tests/update_eve_image/testdata/reupdate_eve_image.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
[!exec:sleep] stop

# Default EVE version to update
{{$eve_ver := "6.0.0"}}

# Obtain EVE version from environment variable EVE_VERSION
{{$env := EdenGetEnv "EVE_VERSION"}}

# If environment variable EVE_VERSION set, use it instead of default
{{if $env}}{{$eve_ver = $env}}{{end}}

# Obtain eve.hv from config
{{$eve_hv := EdenConfig "eve.hv"}}

# Obtain eve.arch from config
{{$eve_arch := EdenConfig "eve.arch"}}

# Combine variables into $short_version
{{$short_version := printf "%s-%s-%s" $eve_ver $eve_hv $eve_arch}}

# Use eden.lim.test for access Infos with timewait 30m
{{$test := "test eden.lim.test -test.v -timewait 30m -test.run TestInfo"}}

# Decrease update testing time
eden controller edge-node update --config timer.test.baseimage.update=30

# Download EVE rootfs into eve-dist
message 'EVE image download'
eden -t 10m utils download eve-rootfs --eve-tag={{$eve_ver}} --eve-hv={{EdenConfig "eve.hv"}} --downloader-dist={{EdenConfigPath "eve.dist"}} -v debug

# Check stdout of previous command. Expected to get full path to squashfs
stdout '{{EdenConfigPath "eve.dist"}}/rootfs-{{ $short_version }}.squashfs'

eden eve version
# Send command to update eveimage
message 'EVE update request'
eden -t 10m controller edge-node eveimage-update file://{{EdenConfigPath "eve.dist"}}/rootfs-{{ $short_version }}.squashfs -m adam://

# Check stderr, it must be empty
! stderr .

eden eve version
! stdout '{{ $short_version }}'

# Run monitoring of Info messages to obtain info with PartitionState active and previously defined ShortVersion
message 'Waiting for EVE update...'
#{{$test}} -out InfoContent.dinfo.SwList[0].ShortVersion 'InfoContent.dinfo.SwList[0].PartitionState:active InfoContent.dinfo.SwList[0].ShortVersion:{{ $short_version }}'
{{$test}} -out InfoContent.dinfo.SwList[0].ShortVersion 'InfoContent.dinfo.SwList[0].PartitionState:inprogress InfoContent.dinfo.SwList[0].ShortVersion:{{ $short_version }}'

# Check stdout of previous command. Expected to get previously defined ShortVersion
stdout '{{ $short_version }}'

eden eve version
stdout '{{ $short_version }}'

eden eve stop
exec sleep 30
eden eve status
! stdout 'EVE on Qemu status: running with pid'
eden eve start

eden eve version
stdout '{{ $short_version }}'

test eden.reboot.test -timewait 10m -reboot=0 -test.v &

# Waiting of eden.reboot.test result
wait
stdout 'Number of reboots:'
! stdout 'FAIL'

eden eve version
! stdout '{{ $short_version }}'

# Reset EVE version
#test eden.escript.test -test.run TestEdenScripts/revert_eve_image_update -test.v -testdata {{EdenConfig "eden.tests"}}/update_eve_image/testdata/

# Reset EVE config
#eden eve reset

# Test's config file
-- eden-config.yml --
test:
controller: adam://{{EdenConfig "adam.ip"}}:{{EdenConfig "adam.port"}}
eve:
{{EdenConfig "eve.name"}}:
onboard-cert: {{EdenConfigPath "eve.cert"}}
serial: "{{EdenConfig "eve.serial"}}"
model: {{EdenConfig "eve.devmodel"}}
78 changes: 78 additions & 0 deletions tests/update_eve_image/testdata/reupdate_eve_oci_image.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Default EVE version to update
{{$eve_ver := "6.0.0"}}

# Obtain EVE version from environment variable EVE_VERSION
{{$env := EdenGetEnv "EVE_VERSION"}}

# If environment variable EVE_VERSION set, use it instead of default
{{if $env}}{{$eve_ver = $env}}{{end}}

# Obtain eve.hv from config
{{$eve_hv := EdenConfig "eve.hv"}}

# Obtain eve.arch from config
{{$eve_arch := EdenConfig "eve.arch"}}

# Combine variables into $short_version
{{$short_version := printf "%s-%s-%s" $eve_ver $eve_hv $eve_arch}}

# Use eden.lim.test for access Infos with timewait 30m
{{$test := "test eden.lim.test -test.v -timewait 30m -test.run TestInfo"}}

# Decrease update testing time
eden controller edge-node update --config timer.test.baseimage.update=30

# Send command to update eveimage from OCI image
message 'EVE update request'
eden -t 10m controller edge-node eveimage-update oci://docker.io/lfedge/eve:{{$eve_ver}}-{{$eve_hv}}-{{$eve_arch}} -m adam://

# Check stderr, it must be empty
! stderr .

eden eve version
! stdout '{{ $short_version }}'

# Run monitoring of Info messages to obtain info with PartitionState inprogress or active and previously defined ShortVersion
message 'Waiting for EVE update...'
{{$test}} -out InfoContent.dinfo.SwList[0].ShortVersion 'InfoContent.dinfo.SwList[0].PartitionState:inprogress InfoContent.dinfo.SwList[0].ShortVersion:{{ $short_version }}'

# Check stdout of previous command. Expected to get previously defined ShortVersion
stdout '{{ $short_version }}'

eden eve version
stdout '{{ $short_version }}'

eden eve stop
exec sleep 30
eden eve status
! stdout 'EVE on Qemu status: running with pid'
eden eve start

eden eve version
stdout '{{ $short_version }}'

test eden.reboot.test -timewait 10m -reboot=0 -test.v &

# Waiting of eden.reboot.test result
wait
stdout 'Number of reboots:'
! stdout 'FAIL'

eden eve version
! stdout '{{ $short_version }}'

# Reset EVE version
#test eden.escript.test -test.run TestEdenScripts/revert_eve_image_update -test.v -testdata {{EdenConfig "eden.tests"}}/update_eve_image/testdata/

# Reset EVE config
#eden eve reset

# Test's config file
-- eden-config.yml --
test:
controller: adam://{{EdenConfig "adam.ip"}}:{{EdenConfig "adam.port"}}
eve:
{{EdenConfig "eve.name"}}:
onboard-cert: {{EdenConfigPath "eve.cert"}}
serial: "{{EdenConfig "eve.serial"}}"
model: {{EdenConfig "eve.devmodel"}}

0 comments on commit 0c57f6f

Please sign in to comment.