diff options
-rw-r--r-- | .travis.yml | 7 | ||||
-rw-r--r-- | test/lib/base.py | 23 | ||||
-rw-r--r-- | test/lib/gobgp.py | 8 | ||||
-rw-r--r-- | test/scenario_test/README.md | 3 | ||||
-rw-r--r-- | test/scenario_test/ci-scripts/jenkins-build-script.sh | 7 | ||||
-rwxr-xr-x | test/scenario_test/ci-scripts/travis-build-script.sh | 2 | ||||
-rwxr-xr-x | test/scenario_test/ci-scripts/travis-install-script.sh | 5 |
7 files changed, 19 insertions, 36 deletions
diff --git a/.travis.yml b/.travis.yml index 2373248e..44082883 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,7 @@ script: test/scenario_test/ci-scripts/travis-build-script.sh env: global: - - DOCKER_IMAGE=gobgp - - FROM_IMAGE=osrg/quagga + - DOCKER_IMAGE=osrg/quagga matrix: allow_failures: @@ -73,7 +72,7 @@ matrix: services: - docker - env: - - TEST=bgp_zebra_nht_test.py FROM_IMAGE=osrg/quagga:v1.0 + - TEST=bgp_zebra_nht_test.py DOCKER_IMAGE=osrg/quagga:v1.0 sudo: required services: - docker @@ -148,7 +147,7 @@ matrix: services: - docker - env: - - TEST=zapi_v3_test.py FROM_IMAGE=osrg/quagga:v1.0 + - TEST=zapi_v3_test.py DOCKER_IMAGE=osrg/quagga:v1.0 sudo: required services: - docker diff --git a/test/lib/base.py b/test/lib/base.py index 4b4ff4ef..2618d720 100644 --- a/test/lib/base.py +++ b/test/lib/base.py @@ -97,29 +97,6 @@ class CmdBuffer(list): return self.delim.join(self) -def make_gobgp_ctn(tag='gobgp', local_gobgp_path='', from_image='osrg/quagga'): - if local_gobgp_path == '': - local_gobgp_path = os.getcwd() - - c = CmdBuffer() - c << 'FROM {0}'.format(from_image) - c << 'ADD gobgp /go/src/github.com/osrg/gobgp/' - c << 'RUN go get github.com/osrg/gobgp/gobgpd' - c << 'RUN go install github.com/osrg/gobgp/gobgpd' - c << 'RUN go get github.com/osrg/gobgp/gobgp' - c << 'RUN go install github.com/osrg/gobgp/gobgp' - - rindex = local_gobgp_path.rindex('gobgp') - if rindex < 0: - raise Exception('{0} seems not gobgp dir'.format(local_gobgp_path)) - - workdir = local_gobgp_path[:rindex] - with lcd(workdir): - local('echo \'{0}\' > Dockerfile'.format(str(c))) - local('docker build -t {0} .'.format(tag)) - local('rm Dockerfile') - - class Bridge(object): def __init__(self, name, subnet='', with_ip=True, self_ip=False): self.name = name diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py index 14fbfe1f..0251a807 100644 --- a/test/lib/gobgp.py +++ b/test/lib/gobgp.py @@ -47,7 +47,8 @@ def extract_path_attribute(path, typ): class GoBGPContainer(BGPContainer): - + LOCAL_GOPATH = os.environ['GOPATH'] + CONTAINER_GOPATH = '/go' SHARED_VOLUME = '/root/shared_volume' QUAGGA_VOLUME = '/etc/quagga' @@ -56,6 +57,11 @@ class GoBGPContainer(BGPContainer): zapi_version=2, ospfd_config=None): super(GoBGPContainer, self).__init__(name, asn, router_id, ctn_image_name) + # Add volume to export local GoBGP executables into container. + self.shared_volumes.append( + (self.LOCAL_GOPATH + '/bin/', self.CONTAINER_GOPATH + '/bin/')) + + # Add volume to export config files into container. self.shared_volumes.append((self.config_dir, self.SHARED_VOLUME)) self.log_level = log_level diff --git a/test/scenario_test/README.md b/test/scenario_test/README.md index f8d1364e..5663d936 100644 --- a/test/scenario_test/README.md +++ b/test/scenario_test/README.md @@ -77,7 +77,8 @@ You also need this operation at every modification to the source code. ```shell $ cd $GOPATH/src/github.com/osrg/gobgp -$ sudo fab -f ./test/lib/base.py make_gobgp_ctn --set tag=gobgp +$ go install ./gobgp/ +$ go install ./gobgpd/ ``` ## <a name="section3"> Run test diff --git a/test/scenario_test/ci-scripts/jenkins-build-script.sh b/test/scenario_test/ci-scripts/jenkins-build-script.sh index 6baf2193..64b14c63 100644 --- a/test/scenario_test/ci-scripts/jenkins-build-script.sh +++ b/test/scenario_test/ci-scripts/jenkins-build-script.sh @@ -33,11 +33,10 @@ do done sudo docker rmi $GOBGP_IMAGE -sudo fab -f $GOBGP/test/lib/base.py make_gobgp_ctn:tag=$GOBGP_IMAGE -[ "$?" != 0 ] && exit "$?" -cd $GOBGP/gobgpd -$GOROOT/bin/go get -v +cd $GOBGP +$GOROOT/bin/go get -v ./gobgp/ +$GOROOT/bin/go get -v ./gobgpd/ cd $GOBGP/test/scenario_test ./run_all_tests.sh diff --git a/test/scenario_test/ci-scripts/travis-build-script.sh b/test/scenario_test/ci-scripts/travis-build-script.sh index 4fd654db..1ed4e05e 100755 --- a/test/scenario_test/ci-scripts/travis-build-script.sh +++ b/test/scenario_test/ci-scripts/travis-build-script.sh @@ -2,4 +2,4 @@ echo "travis-build-script.sh" -sudo PYTHONPATH=test python test/scenario_test/$TEST --gobgp-image $DOCKER_IMAGE -x -s +PYTHONPATH=test python test/scenario_test/$TEST --gobgp-image $DOCKER_IMAGE -x -s diff --git a/test/scenario_test/ci-scripts/travis-install-script.sh b/test/scenario_test/ci-scripts/travis-install-script.sh index 5270ac21..72bdc79d 100755 --- a/test/scenario_test/ci-scripts/travis-install-script.sh +++ b/test/scenario_test/ci-scripts/travis-install-script.sh @@ -2,6 +2,7 @@ echo "travis-install-script.sh" -sudo -H pip --quiet install -r test/pip-requires.txt +pip --quiet install -r test/pip-requires.txt -sudo fab -f test/lib/base.py make_gobgp_ctn:tag=$DOCKER_IMAGE,from_image=$FROM_IMAGE +go get -v ./gobgp/ +go get -v ./gobgpd/ |