Skip to content

Commit bf81b00

Browse files
authored
Vagrant tests, upgrades & addition of FreeBSD (mistifyio#83)
Update Ubuntu box to 20.04 Add FreeBSD Run tests as part of provision script
2 parents 9cb82b9 + 292b9d8 commit bf81b00

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

Vagrantfile

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
VAGRANTFILE_API_VERSION = "2"
2-
3-
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
4-
config.vm.box = "ubuntu/trusty64"
1+
GOVERSION = "1.17.8"
2+
3+
Vagrant.configure("2") do |config|
4+
config.vm.define "ubuntu" do |ubuntu|
5+
ubuntu.vm.box = "generic/ubuntu2004"
6+
end
7+
config.vm.define "freebsd" do |freebsd|
8+
freebsd.vm.box = "generic/freebsd13"
9+
end
510
config.ssh.forward_agent = true
6-
711
config.vm.synced_folder ".", "/home/vagrant/go/src/github.com/mistifyio/go-zfs", create: true
8-
9-
config.vm.provision "shell", inline: <<EOF
10-
cat << END > /etc/profile.d/go.sh
11-
export GOPATH=\\$HOME/go
12-
export PATH=\\$GOPATH/bin:/usr/local/go/bin:\\$PATH
13-
END
14-
15-
chown -R vagrant /home/vagrant/go
16-
17-
apt-get update
18-
apt-get install -y software-properties-common curl
19-
apt-add-repository --yes ppa:zfs-native/stable
20-
apt-get update
21-
apt-get install -y ubuntu-zfs
22-
23-
cd /home/vagrant
24-
curl -z go1.3.3.linux-amd64.tar.gz -L -O https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz
25-
tar -C /usr/local -zxf /home/vagrant/go1.3.3.linux-amd64.tar.gz
26-
27-
cat << END > /etc/sudoers.d/go
28-
Defaults env_keep += "GOPATH"
29-
END
30-
31-
EOF
12+
config.vm.provision "shell", inline: <<-EOF
13+
set -euxo pipefail
14+
15+
os=$(uname -s|tr '[A-Z]' '[a-z]')
16+
case $os in
17+
linux) apt-get update -y && apt-get install -y --no-install-recommends gcc libc-dev zfsutils-linux ;;
18+
esac
19+
20+
cd /tmp
21+
curl -fLO --retry-max-time 30 --retry 10 https://go.dev/dl/go#{GOVERSION}.$os-amd64.tar.gz
22+
tar -C /usr/local -zxf go#{GOVERSION}.$os-amd64.tar.gz
23+
ln -nsf /usr/local/go/bin/go /usr/local/bin/go
24+
rm -rf go*.tar.gz
25+
26+
chown -R vagrant:vagrant /home/vagrant/go
27+
cd /home/vagrant/go/src/github.com/mistifyio/go-zfs
28+
go test -c
29+
sudo ./go-zfs.test -test.v
30+
CGO_ENABLED=0 go test -c
31+
sudo ./go-zfs.test -test.v
32+
EOF
3233
end

0 commit comments

Comments
 (0)