Skip to content

Commit

Permalink
app_nonat test
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Sadov <[email protected]>
  • Loading branch information
zed-sadov committed May 10, 2021
1 parent 8b35fe6 commit 3fc77ff
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 5 deletions.
99 changes: 99 additions & 0 deletions tests/eclient/testdata/app_nonat.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Test for apllications network connectivity switching

{{$test_msg := "This is a test"}}
{{define "ssh"}}ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -i {{EdenConfig "eden.tests"}}/eclient/image/cert/id_rsa -p 2223 root@{{end}}

[!exec:bash] stop
[!exec:sleep] stop
[!exec:ssh] stop
[!exec:chmod] stop

exec chmod 600 {{EdenConfig "eden.tests"}}/eclient/image/cert/id_rsa

# Starting of reboot detector with 2 reboots limit
! test eden.reboot.test -test.v -timewait 10m -reboot=0 -count=2 &

message 'Resetting of EVE'
eden eve reset
exec sleep 20

message 'Creating networks'
eden network create 10.11.12.0/24 -n indirect
eden network create --type switch --uplink eth0 -n direct

test eden.network.test -test.v -timewait 10m ACTIVATED indirect direct

message 'Starting applications'
eden pod deploy -v debug -n eclient docker://itmoeve/eclient:0.4 -p 2223:22 --networks=indirect --networks=direct --memory=512MB

message 'Waiting of running'
test eden.app.test -test.v -timewait 30m RUNNING eclient

message 'Checking accessibility'
exec -t 5m bash wait_ssh.sh 2223

message 'Testing of network'
exec sleep 20
exec -t 1m bash ping.sh
stdout '0% packet loss'

message 'Switching network'
eden pod modify eclient --networks indirect --networks=direct --acl='direct:'
test eden.app.test -test.v -timewait 30m RUNNING eclient

! exec -t 1m bash ping.sh
stdout '100% packet loss'

message 'Resource cleanng'
eden pod delete eclient

test eden.app.test -test.v -timewait 10m - eclient

stop
eden network delete direct
eden network delete indirect

test eden.network.test -test.v -timewait 10m - direct indirect

stdout 'no network with direct found'
stdout 'no network with indirect found'

eden network ls
! stdout '^direct\s'
! stdout '^indirect\s'

-- wait_ssh.sh --
EDEN={{EdenConfig "eden.root"}}/{{EdenConfig "eden.bin-dist"}}/{{EdenConfig "eden.eden-bin"}}
HOST=$($EDEN eve ip)

for p in $*
do
for i in `seq 20`
do
sleep 20
# Test SSH-access to container
echo {{template "ssh"}}$HOST -p $p grep -q Ubuntu /etc/issue
{{template "ssh"}}$HOST -p $p grep -q Ubuntu /etc/issue && break
done
done

-- ping.sh --
EDEN={{EdenConfig "eden.root"}}/{{EdenConfig "eden.bin-dist"}}/{{EdenConfig "eden.eden-bin"}}
HOST=$($EDEN eve ip)

#echo {{template "ssh"}}$HOST route add default gw 192.168.0.2 dev eth1
#{{template "ssh"}}$HOST route add default gw 192.168.0.2 dev eth1
echo {{template "ssh"}}$HOST sysctl net.ipv4.conf.eth1.rp_filter=2
{{template "ssh"}}$HOST sysctl net.ipv4.conf.eth1.rp_filter=2
echo {{template "ssh"}}$HOST ping -I eth1 -c 50 www.google.com
{{template "ssh"}}$HOST ping -I eth1 -c 50 www.google.com

-- eden-config.yml --
{{/* Test's config. file */}}
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"}}
14 changes: 9 additions & 5 deletions tests/workflow/eden.workflow.tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Number of tests
{{$tests := 35}}
{{$tests := 37}}
# EDEN_TEST env. var. -- flavour of test set: "small", "medium"(default) and "large"
{{$workflow := EdenGetEnv "EDEN_TEST"}}
# EDEN_TEST_SETUP env. var. -- "y"(default) performs the EDEN setup steps
Expand Down Expand Up @@ -124,18 +124,22 @@ eden.escript.test -test.run TestEdenScripts/eden_reset
{{ if (eq $workflow "large") }}
/bin/echo Eden's testing the maximum application limit (32/{{$tests}})
eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/eclients
{{if or (eq $devmodel "ZedVirtual-4G") }}
/bin/echo Eden's testing the maximum application limit (33/{{$tests}})
eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/app_nonat
{{end}}
{{end}}

/bin/echo Eden Reboot test (33/{{$tests}})
/bin/echo Eden Reboot test (34/{{$tests}})
eden.escript.test -test.run TestEdenScripts/reboot_test
{{ if ne $workflow "small" }}
/bin/echo Eden base OS update http (34/{{$tests}})
/bin/echo Eden base OS update http (35/{{$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}})
/bin/echo Eden base OS update oci (36/{{$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 (36/{{$tests}})
/bin/echo Eden stop (37/{{$tests}})
eden.escript.test -test.run TestEdenScripts/eden_stop
{{end}}

0 comments on commit 3fc77ff

Please sign in to comment.