diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..34daa49 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +language: go + +go: + - 1.11.x + - 1.10.x + +go_import_path: github.com/gluster/gogfapi + +dist: xenial +addons: + apt: + update: true + packages: + - glusterfs-common + +services: + - docker + +before_script: + - bash -x test_setup.sh + +script: + - go test -v ./... diff --git a/test_setup.sh b/test_setup.sh new file mode 100755 index 0000000..d2ac958 --- /dev/null +++ b/test_setup.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +docker run -d --name gluster-test \ + -p 24007:24007/tcp -p 24008:24008/tcp -p 24007:24007/udp -p 24008:24008/udp \ + -p 49152:49152/tcp -p 49152:49152/udp -p 49153:49153/tcp -p 49154:49154/tcp \ + -v /sys/fs/cgroup:/sys/fs/cgroup:ro --privileged=true \ + gluster/gluster-centos:gluster4u0_centos7 + +# wait for glusterd service to be active +while ! docker exec gluster-test systemctl is-active glusterd; do + sleep 1 +done + +docker exec gluster-test /bin/sh -c "echo '127.0.1.1 $(hostname)' >> /etc/hosts" +docker exec gluster-test gluster volume create test $(hostname):/srv force +docker exec gluster-test gluster volume set test storage.owner-uid $(id -u) +docker exec gluster-test gluster volume start test