Skip to content

Commit

Permalink
Fix acc tests
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
  • Loading branch information
roidelapluie committed May 1, 2019
1 parent 8b851f1 commit 8ff8d45
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
45 changes: 29 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
dist: trusty
sudo: required
services:
- docker
language: go
go:
- "1.11.x"
env:
- GOFLAGS=-mod=vendor GO111MODULE=on GITLAB_BASE_URL=http://127.0.0.1:8080/api/v4 GITLAB_TOKEN=ACCTEST
matrix:
fast_finish: false
include:
- name: unit tests
env: MAKE_TARGET=test GOFLAGS=-mod=vendor GO111MODULE=on
go: "1.11.x"
- name: acceptance tests
env: MAKE_TARGET=testacc GOFLAGS=-mod=vendor GO111MODULE=on GITLAB_BASE_URL=http://127.0.0.1:8080/api/v4 GITLAB_TOKEN=ACCTEST
go: "1.11.x"
- name: govet tests
env: MAKE_TARGET=vet GOFLAGS=-mod=vendor GO111MODULE=on
go: "1.11.x"
- name: website tests
env: MAKE_TARGET=website-test GOFLAGS=-mod=vendor GO111MODULE=on
go: "1.11.x"
- name: unit tests (go 1.12)
env: MAKE_TARGET=test GOFLAGS=-mod=vendor GO111MODULE=on
go: "1.12.x"
- name: unit tests (go tip)
env: MAKE_TARGET=test GOFLAGS=-mod=vendor GO111MODULE=on
go: tip
allow_failures:
- name: unit tests (go tip)
env: MAKE_TARGET=test GOFLAGS=-mod=vendor GO111MODULE=on
go: tip
- name: unit tests (go 1.12)
env: MAKE_TARGET=test GOFLAGS=-mod=vendor GO111MODULE=on
go: "1.12.x"

install:
# This script is used by the Travis build to install a cookie for
Expand All @@ -17,15 +37,8 @@ install:
- bash scripts/start-gitlab.sh

script:
- make test
- make testacc
- make vet
- make website-test
- make $MAKE_TARGET

branches:
only:
- master
matrix:
fast_finish: true
allow_failures:
- go: tip
3 changes: 3 additions & 0 deletions scripts/generate-access-token.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
terraform_token = PersonalAccessToken.create(user_id: 1, scopes: [:api, :read_user], name: :terraform)
terraform_token.set_token(:ACCTEST)
terraform_token.save!
3 changes: 2 additions & 1 deletion scripts/start-gitlab.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash -e
if [[ $MAKE_TARGET != "testacc" ]]; then echo "not starting gitlab!"; exit 0; fi
echo "Starting gitlab container..."
docker run -d -e GITLAB_ROOT_PASSWORD=adminadmin --rm -p 127.0.0.1:8080:80 --name gitlab gitlab/gitlab-ce
echo -n "Waiting for gitlab to be ready "
Expand All @@ -12,4 +13,4 @@ do
done
echo
echo "Creating access token"
echo 'PersonalAccessToken.create(user_id: 1, scopes: [:api, :read_user], name: :terraform, token: :ACCTEST).save!' | docker exec -i gitlab gitlab-rails console
docker exec -i gitlab gitlab-rails console < scripts/generate-access-token.rb

0 comments on commit 8ff8d45

Please sign in to comment.