From 7db2341e9a11d06061d78ab6d5f756028d2f1c46 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 | 45 +++++++++++++++++++ 2 files changed, 46 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 2bf97358c..587bea80f 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 -test.timeout 10m +eden.escript.test -test.run TestEdenScripts/update_eve_image_oci -test.timeout 10m 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..691afe2b0 --- /dev/null +++ b/tests/update_eve_image/testdata/update_eve_image_oci.txt @@ -0,0 +1,45 @@ +# 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 }}' + + +# 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"}}