Skip to content

Commit

Permalink
Add automated travis testing
Browse files Browse the repository at this point in the history
Starts a docker container with gluster server to do tests. It's based on

https://github.com/src-d/go-billy-gluster

Signed-off-by: Javi Fontan <jfontan@gmail.com>
  • Loading branch information
jfontan committed Dec 11, 2018
1 parent db87cbf commit 5082c86
Showing 2 changed files with 40 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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 ./...
17 changes: 17 additions & 0 deletions test_setup.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5082c86

Please sign in to comment.