This repository was archived by the owner on Feb 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +27
-2
lines changed
Expand file tree Collapse file tree 4 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 1616
1717before_install :
1818 - sudo apt-get update -qq
19- - sudo apt-get install -y -qq autoconf automake pkg-config libdevmapper-dev libsqlite3-dev libvirt-dev libvirt-bin aufs-tools wget libaio1 libpixman-1-0
19+ - sudo apt-get install -y -qq autoconf automake pkg-config libdevmapper-dev libsqlite3-dev libvirt-dev libvirt-bin aufs-tools wget libaio1 libpixman-1-0 netcat
2020 - wget https://s3-us-west-1.amazonaws.com/hypercontainer-download/qemu-hyper/qemu-hyper_2.4.1-1_amd64.deb && sudo dpkg -i --force-all qemu-hyper_2.4.1-1_amd64.deb
2121 - cd `mktemp -d`
2222 - mkdir -p ${GOPATH}/src/github.com/hyperhq
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package pod
33import (
44 "fmt"
55 "path/filepath"
6+ "strings"
67 "sync"
78 "time"
89
@@ -419,7 +420,8 @@ func (p *XPod) prepareResources() error {
419420 return err
420421 }
421422 if p .containerIP == "" {
422- p .containerIP = inf .descript .Ip
423+ fields := strings .SplitN (inf .descript .Ip , "/" , 2 )
424+ p .containerIP = fields [0 ]
423425 }
424426 }
425427
Original file line number Diff line number Diff line change @@ -242,3 +242,25 @@ hyper::test::container_readonly_rootfs_and_volume() {
242242 sudo hyperctl rm $id
243243 test $res1 -eq 0 -a $res2 -eq 0
244244}
245+
246+ hyper::test::portmapping () {
247+ echo " Container portmapping test"
248+ ipaddr=$( ip addr show hyper0 | sed -ne ' s/.*inet \([.0-9]\{7,15\}\)\/[0-9]\{1,2\} .*/\1/p' )
249+ echo " hyper0 address is $ipaddr "
250+ started=
251+ while read output; do
252+ response=$( echo " $output " | tr -d " [:space:]" )
253+ echo " got $response "
254+ if [ " x$started " == " x" ]; then
255+ started=$response
256+ sleep 3
257+ nc $ipaddr 3000 << END
258+ ok
259+ END
260+ elif [ " x$response " = " xok" ]; then
261+ return 0
262+ else
263+ return 1
264+ fi
265+ done < <( sudo hyperctl run -t --rm --publish 3000:1300 busybox:latest sh -c ' echo "start" ; nc -l -p 1300' )
266+ }
Original file line number Diff line number Diff line change @@ -199,6 +199,7 @@ __EOF__
199199 hyper::test::force_kill_container
200200 hyper::test::container_logs_no_newline
201201 hyper::test::container_readonly_rootfs_and_volume
202+ hyper::test::portmapping
202203
203204 stop_hyperd
204205}
You can’t perform that action at this time.
0 commit comments