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 12, 2021
1 parent 8b35fe6 commit 846fea6
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 6 deletions.
96 changes: 96 additions & 0 deletions tests/eclient/testdata/app_nonat.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Test app_nonat is verifying that we can use a switch network instance on a management port.

{{define "port"}}2223{{end}}
{{define "ssh"}}ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -i {{EdenConfig "eden.tests"}}/eclient/image/cert/id_rsa -p {{template "port"}} 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 {{template "port"}}: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

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

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

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

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

message 'Resource cleaning'
eden pod delete eclient

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

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 i in `seq 20`
do
sleep 20
# Test SSH-access to container
echo {{template "ssh"}}$HOST grep -q Ubuntu /etc/issue
{{template "ssh"}}$HOST grep -q Ubuntu /etc/issue && break
done

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

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: 8 additions & 6 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 @@ -122,20 +122,22 @@ eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/disk
eden.escript.test -test.run TestEdenScripts/eden_reset
{{end}}
{{ if (eq $workflow "large") }}
/bin/echo Eden's testing the maximum application limit (32/{{$tests}})
/bin/echo Verifying that we can use a switch network instance on a management port (32/{{$tests}})
eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/app_nonat
/bin/echo Eden's testing the maximum application limit (33/{{$tests}})
eden.escript.test -testdata ../eclient/testdata/ -test.run TestEdenScripts/eclients
{{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 846fea6

Please sign in to comment.