Skip to content

Commit

Permalink
Update ci-test.sh (TykTechnologies#2631)
Browse files Browse the repository at this point in the history
This PR removes redundant `LATEST_GO` checks in `ci-test.sh` script. Also, it renames the script name as  `ci-tests.sh` to be compatible with `tyk-analytics`.
  • Loading branch information
furkansenharputlu authored and buger committed Nov 7, 2019
1 parent b186d00 commit afb45a8
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 68 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ addons:
matrix:
include:
- go: 1.12.x
env: LATEST_GO=true # run linters and report coverage


services:
- redis-server
Expand All @@ -41,6 +39,6 @@ script:
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends $(travis_apt_get_options) install nodejs
- sudo npm install -g api-spec-converter --unsafe-perm=true --allow-root
- go build -tags 'coprocess lua'
- ./bin/ci-test.sh
- ./bin/ci-tests.sh
- if [[ $LATEST_GO ]]; then goveralls -coverprofile=<(gocovmerge *.cov); fi
- ./bin/ci-benchmark.sh
65 changes: 0 additions & 65 deletions bin/ci-test.sh

This file was deleted.

57 changes: 57 additions & 0 deletions bin/ci-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

TEST_TIMEOUT=5m

# print a command and execute it
show() {
echo "$@" >&2
eval "$@"
}

fatal() {
echo "$@" >&2
exit 1
}

FMT_FILES=$(gofmt -l . | grep -v vendor)
if [[ -n ${FMT_FILES} ]]; then
fatal "Run 'gofmt -w' on these files:\n$FMT_FILES"
fi

echo "gofmt check is ok!"

IMP_FILES="$(goimports -l . | grep -v vendor)"
if [[ -n ${IMP_FILES} ]]; then
fatal "Run 'goimports -w' on these files:\n$IMP_FILES"
fi

echo "goimports check is ok!"

PKGS="$(go list ./...)"

export PKG_PATH=${GOPATH}/src/github.com/TykTechnologies/tyk

# build Go-plugin used in tests
go build -o ./test/goplugins/goplugins.so -buildmode=plugin ./test/goplugins || fatal "building Go-plugin failed"

for pkg in ${PKGS}; do
tags=""

# TODO: Remove skipRace variable after solving race conditions in tests.
skipRace=false
if [[ ${pkg} == *"grpc" ]]; then
skipRace=true
elif [[ ${pkg} == *"goplugin" ]]; then
skipRace=true
tags="-tags 'goplugin'"
fi

race="-race"

if [[ ${skipRace} = true ]]; then
race=""
fi

show go test -v ${race} -timeout ${TEST_TIMEOUT} -coverprofile=test.cov ${pkg} ${tags} || fatal "Test Failed"
show go vet ${tags} ${pkg} || fatal "go vet errored"
done

0 comments on commit afb45a8

Please sign in to comment.