-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Oleg Sadov <[email protected]>
- Loading branch information
Showing
2 changed files
with
108 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters