From 1886836b0bae02ac1791ae4fbbe641247f3f65d0 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 | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) 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..993998847 --- /dev/null +++ b/tests/update_eve_image/testdata/update_eve_image_oci.txt @@ -0,0 +1,50 @@ +# Default EVE version to update +{{$eve_ver := "6.1.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"}} + +# Send command to update eveimage from OCI image +message 'EVE update request' +eden -t 10m controller edge-node eveimage-update oci://lfedge/eve:{{$eve_ver}}-{{$eve_hv}} -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:inprogress|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"}}