PMM-2605 Removed go 1.9.x from .travis.yml

Also updated Makefile to run all the tests
This commit is contained in:
Carlos Salguero
2019-11-11 10:46:57 -03:00
parent 061e6bb5c1
commit 3caa8c4a25
8 changed files with 57 additions and 46 deletions

1
.gitignore vendored
View File

@@ -20,6 +20,7 @@ src/go/pt-mongodb-summary/vendor/
vendor/ vendor/
*.bak *.bak
src/go/*.bak src/go/*.bak
src/go/.env
config/deb/control.bak config/deb/control.bak
config/rpm/percona-toolkit.spec.bak config/rpm/percona-toolkit.spec.bak
config/sphinx-build/percona-theme/* config/sphinx-build/percona-theme/*

View File

@@ -1,7 +1,6 @@
language: go language: go
go: go:
- 1.9.x
- 1.10.x - 1.10.x
- 1.12.x - 1.12.x

View File

@@ -1,26 +0,0 @@
GOCACHE=
GOLANG_DOCKERHUB_TAG=1.10-stretch
TEST_MONGODB_ADMIN_USERNAME=admin
TEST_MONGODB_ADMIN_PASSWORD=admin123456
TEST_MONGODB_USERNAME=test
TEST_MONGODB_PASSWORD=123456
TEST_MONGODB_S1_RS=rs1
TEST_MONGODB_STANDALONE_PORT=27017
TEST_MONGODB_S1_PRIMARY_PORT=17001
TEST_MONGODB_S1_SECONDARY1_PORT=17002
TEST_MONGODB_S1_SECONDARY2_PORT=17003
TEST_MONGODB_S2_RS=rs2
TEST_MONGODB_S2_PRIMARY_PORT=17004
TEST_MONGODB_S2_SECONDARY1_PORT=17005
TEST_MONGODB_S2_SECONDARY2_PORT=17006
TEST_MONGODB_S3_RS=rs3
TEST_MONGODB_S3_PRIMARY_PORT=17021
TEST_MONGODB_S3_SECONDARY1_PORT=17022
TEST_MONGODB_S3_SECONDARY2_PORT=17023
TEST_MONGODB_CONFIGSVR_RS=csReplSet
TEST_MONGODB_CONFIGSVR1_PORT=17007
TEST_MONGODB_CONFIGSVR2_PORT=17008
TEST_MONGODB_CONFIGSVR3_PORT=17009
TEST_MONGODB_MONGOS_PORT=17000
TEST_PSMDB_VERSION=3.6
TEST_MONGODB_FLAVOR=percona/percona-server-mongodb

View File

@@ -1,3 +1,8 @@
help: ## Display this help message.
@echo "Please use \`make <target>\` where <target> is one of:"
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
awk -F ':.*?## ' 'NF==2 {printf " %-26s%s\n", $$1, $$2}'
GO := go GO := go
pkgs = $(shell find . -type d -name "pt-*" -exec basename {} \;) pkgs = $(shell find . -type d -name "pt-*" -exec basename {} \;)
VERSION=$(shell git describe --abbrev=0 --tags) VERSION=$(shell git describe --abbrev=0 --tags)
@@ -5,6 +10,7 @@ BUILD=$(shell date +%FT%T%z)
GOVERSION=$(shell go version | cut --delimiter=" " -f3) GOVERSION=$(shell go version | cut --delimiter=" " -f3)
COMMIT=$(shell git rev-list -1 HEAD) COMMIT=$(shell git rev-list -1 HEAD)
GOUTILSDIR ?= $(GOPATH)/bin GOUTILSDIR ?= $(GOPATH)/bin
FILES = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
PREFIX=$(shell pwd) PREFIX=$(shell pwd)
TOP_DIR=$(shell git rev-parse --show-toplevel) TOP_DIR=$(shell git rev-parse --show-toplevel)
@@ -91,7 +97,7 @@ endef
env: env:
@echo $(TEST_ENV) | tr ' ' '\n' >.env @echo $(TEST_ENV) | tr ' ' '\n' >.env
test-cluster: env env-up: env ## Start MongoDB docker containers cluster
TEST_PSMDB_VERSION=$(TEST_PSMDB_VERSION) \ TEST_PSMDB_VERSION=$(TEST_PSMDB_VERSION) \
docker-compose up \ docker-compose up \
--detach \ --detach \
@@ -101,40 +107,41 @@ test-cluster: env
init init
docker/test/init-cluster-wait.sh docker/test/init-cluster-wait.sh
test-cluster-clean: env env-down: env ## Clean-up MongoDB docker containers cluster
docker-compose down -v docker-compose down -v
rm .env
linux-amd64: linux-amd64: ## Build Mongo tools for linux-amd64
@echo "Building linux/amd64 binaries in ${BIN_DIR}" @echo "Building linux/amd64 binaries in ${BIN_DIR}"
@cd ${TOP_DIR} && dep ensure @cd ${TOP_DIR} && dep ensure
@$(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;) @$(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;)
@$(foreach pkg,$(pkgs),GOOS=linux GOARCH=amd64 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);) @$(foreach pkg,$(pkgs),GOOS=linux GOARCH=amd64 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);)
linux-386: linux-386: ## Build Mongo tools for linux-386
@echo "Building linux/386 binaries in ${BIN_DIR}" @echo "Building linux/386 binaries in ${BIN_DIR}"
@cd ${TOP_DIR} && dep ensure @cd ${TOP_DIR} && dep ensure
@$(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;) @$(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;)
@$(foreach pkg,$(pkgs),GOOS=linux GOARCH=386 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);) @$(foreach pkg,$(pkgs),GOOS=linux GOARCH=386 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);)
darwin-amd64: darwin-amd64: ## Build Mongo tools for darwin-amd64 (MacOS)
@echo "Building darwin/amd64 binaries in ${BIN_DIR}" @echo "Building darwin/amd64 binaries in ${BIN_DIR}"
@cd ${TOP_DIR} && dep ensure @cd ${TOP_DIR} && dep ensure
@$(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;) @$(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;)
@$(foreach pkg,$(pkgs),GOOS=darwin GOARCH=amd64 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);) @$(foreach pkg,$(pkgs),GOOS=darwin GOARCH=amd64 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);)
style: style: ## Check code style
@echo ">> checking code style" @echo ">> checking code style"
@! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^' @! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
test: test: ## Run tests
@echo ">> running tests" @echo ">> running tests"
@./runtests.sh @./runtests.sh
format: format: ## Format source code.
@echo ">> formatting code" gofmt -w -s $(FILES)
@$(GO) fmt $(pkgs) goimports -local github.com/percona/pmm-managed -l -w $(FILES)
vet: vet: ## Run vet on Go code
@echo ">> vetting code" @echo ">> vetting code"
@$(GO) vet $(pkgs) @$(foreach pkg,$(pkgs), cd $(TOP_DIR)/src/go/$(pkg); go vet ./... ;)

View File

@@ -143,6 +143,30 @@ services:
- configsvr1 - configsvr1
# - configsvr2 # - configsvr2
# - configsvr3 # - configsvr3
postgres9:
image: ${MYSQL_IMAGE:-postgres:9.6}
ports:
- ${POSTGRE_HOST:-127.0.0.1}:${POSTGRE_96_PORT:-6432}:5432
environment:
- POSTGRES_PASSWORD=root
postgres10:
image: ${POSTGRE_IMAGE:-postgres:10.7}
ports:
- ${POSTGRE_HOST:-127.0.0.1}:${POSTGRE_10_PORT:-6433}:5432
environment:
- POSTGRES_PASSWORD=root
postgres11:
image: ${POSTGRE_IMAGE:-postgres:11}
ports:
- ${POSTGRE_HOST:-127.0.0.1}:${POSTGRE_11_PORT:-6434}:5432
environment:
- POSTGRES_PASSWORD=root
postgres12:
image: ${POSTGRE_IMAGE:-postgres:12}
ports:
- ${POSTGRE_HOST:-127.0.0.1}:${POSTGRE_12_PORT:-6435}:5432
environment:
- POSTGRES_PASSWORD=root
init: init:
network_mode: host network_mode: host
image: ${TEST_MONGODB_FLAVOR}:${TEST_PSMDB_VERSION} image: ${TEST_MONGODB_FLAVOR}:${TEST_PSMDB_VERSION}
@@ -166,6 +190,10 @@ services:
- s3-mongo2 - s3-mongo2
- s3-mongo3 - s3-mongo3
- standalone - standalone
- postgres9
- postgres10
- postgres11
- postgres12
test: test:
build: build:
dockerfile: docker/test/Dockerfile dockerfile: docker/test/Dockerfile

View File

@@ -18,7 +18,7 @@ func TestCheckUpdates(t *testing.T) {
m := strings.Split(string(body), ";") m := strings.Split(string(body), ";")
advices := []Advice{ advices := []Advice{
Advice{ {
Hash: m[0], Hash: m[0],
ToolName: m[1], ToolName: m[1],
Advice: "There is a new version", Advice: "There is a new version",

View File

@@ -23,10 +23,10 @@ const (
ipv6PG11Port = "6432" ipv6PG11Port = "6432"
ipv6PG12Port = "6432" ipv6PG12Port = "6432"
pg9Container = "pt-pg-summary_postgres9_1" pg9Container = "go_postgres9_1"
pg10Container = "pt-pg-summary_postgres10_1" pg10Container = "go_postgres10_1"
pg11Container = "pt-pg-summary_postgres11_1" pg11Container = "go_postgres11_1"
pg12Container = "pt-pg-summary_postgres12_1" pg12Container = "go_postgres12_1"
) )
var ( var (

View File

@@ -4,7 +4,9 @@ export BASEDIR=$(git rev-parse --show-toplevel)
export CHECK_SESSIONS=0 export CHECK_SESSIONS=0
cd $BASEDIR cd $BASEDIR
for dir in $(ls -d pt-*) source ${BASEDIR}/src/go/setenv.sh
for dir in $(ls -d ./src/go/pt-*)
do do
echo "Running tests at $BASEDIR/$dir" echo "Running tests at $BASEDIR/$dir"
cd $BASEDIR/$dir cd $BASEDIR/$dir