From 8dbacb67bba39c984d84a77bb0b9bd71c5ca340b Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Thu, 11 Mar 2021 19:19:50 +0200 Subject: [PATCH] run tests from docker image directly Signed-off-by: Avi Deitcher --- .../eden.update_eve_image.tests.txt | 1 + .../testdata/update_eve_image_oci.txt | 53 +++++++++++++++++++ tests/workflow/eden.workflow.tests.txt | 6 ++- 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 tests/update_eve_image/testdata/update_eve_image_oci.txt diff --git a/tests/update_eve_image/eden.update_eve_image.tests.txt b/tests/update_eve_image/eden.update_eve_image.tests.txt index 5a46c5fff..5ab1e4015 100644 --- a/tests/update_eve_image/eden.update_eve_image.tests.txt +++ b/tests/update_eve_image/eden.update_eve_image.tests.txt @@ -1 +1,2 @@ eden.escript.test -test.run TestEdenScripts/update_eve_image_http -test.timeout 60m +eden.escript.test -test.run TestEdenScripts/update_eve_image_oci -test.timeout 60m diff --git a/tests/update_eve_image/testdata/update_eve_image_oci.txt b/tests/update_eve_image/testdata/update_eve_image_oci.txt new file mode 100644 index 000000000..0d5916044 --- /dev/null +++ b/tests/update_eve_image/testdata/update_eve_image_oci.txt @@ -0,0 +1,53 @@ +# 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 . + +# 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:active InfoContent.dinfo.SwList[0].ShortVersion:{{ $short_version }}' + +# Check stdout of previous command. Expected to get previously defined ShortVersion +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"}} diff --git a/tests/workflow/eden.workflow.tests.txt b/tests/workflow/eden.workflow.tests.txt index 722fb342e..a038b8321 100644 --- a/tests/workflow/eden.workflow.tests.txt +++ b/tests/workflow/eden.workflow.tests.txt @@ -119,11 +119,13 @@ eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/eclie /bin/echo Eden Reboot test (33/{{$tests}}) eden.escript.test -test.run TestEdenScripts/reboot_test {{ if ne $workflow "small" }} -/bin/echo Eden base OS update (34/{{$tests}}) +/bin/echo Eden base OS update http (34/{{$tests}}) eden.escript.test -testdata ../update_eve_image/testdata/ -test.run TestEdenScripts/update_eve_image_http +/bin/echo Eden base OS update oci (35/{{$tests}}) +eden.escript.test -testdata ../update_eve_image/testdata/ -test.run TestEdenScripts/update_eve_image_oci {{end}} {{if (eq $stop "y")}} -/bin/echo Eden stop (35/{{$tests}}) +/bin/echo Eden stop (36/{{$tests}}) eden.escript.test -test.run TestEdenScripts/eden_stop {{end}}