mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 15:39:03 +00:00
PMM-2605 Removed go 1.9.x from .travis.yml
Also updated Makefile to run all the tests
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -20,6 +20,7 @@ src/go/pt-mongodb-summary/vendor/
|
||||
vendor/
|
||||
*.bak
|
||||
src/go/*.bak
|
||||
src/go/.env
|
||||
config/deb/control.bak
|
||||
config/rpm/percona-toolkit.spec.bak
|
||||
config/sphinx-build/percona-theme/*
|
||||
|
@@ -1,7 +1,6 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.9.x
|
||||
- 1.10.x
|
||||
- 1.12.x
|
||||
|
||||
|
26
src/go/.env
26
src/go/.env
@@ -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
|
@@ -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
|
||||
pkgs = $(shell find . -type d -name "pt-*" -exec basename {} \;)
|
||||
VERSION=$(shell git describe --abbrev=0 --tags)
|
||||
@@ -5,6 +10,7 @@ BUILD=$(shell date +%FT%T%z)
|
||||
GOVERSION=$(shell go version | cut --delimiter=" " -f3)
|
||||
COMMIT=$(shell git rev-list -1 HEAD)
|
||||
GOUTILSDIR ?= $(GOPATH)/bin
|
||||
FILES = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
|
||||
|
||||
PREFIX=$(shell pwd)
|
||||
TOP_DIR=$(shell git rev-parse --show-toplevel)
|
||||
@@ -91,7 +97,7 @@ endef
|
||||
env:
|
||||
@echo $(TEST_ENV) | tr ' ' '\n' >.env
|
||||
|
||||
test-cluster: env
|
||||
env-up: env ## Start MongoDB docker containers cluster
|
||||
TEST_PSMDB_VERSION=$(TEST_PSMDB_VERSION) \
|
||||
docker-compose up \
|
||||
--detach \
|
||||
@@ -101,40 +107,41 @@ test-cluster: env
|
||||
init
|
||||
docker/test/init-cluster-wait.sh
|
||||
|
||||
test-cluster-clean: env
|
||||
env-down: env ## Clean-up MongoDB docker containers cluster
|
||||
docker-compose down -v
|
||||
rm .env
|
||||
|
||||
linux-amd64:
|
||||
linux-amd64: ## Build Mongo tools for linux-amd64
|
||||
@echo "Building linux/amd64 binaries in ${BIN_DIR}"
|
||||
@cd ${TOP_DIR} && dep ensure
|
||||
@$(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);)
|
||||
|
||||
linux-386:
|
||||
linux-386: ## Build Mongo tools for linux-386
|
||||
@echo "Building linux/386 binaries in ${BIN_DIR}"
|
||||
@cd ${TOP_DIR} && dep ensure
|
||||
@$(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);)
|
||||
|
||||
darwin-amd64:
|
||||
darwin-amd64: ## Build Mongo tools for darwin-amd64 (MacOS)
|
||||
@echo "Building darwin/amd64 binaries in ${BIN_DIR}"
|
||||
@cd ${TOP_DIR} && dep ensure
|
||||
@$(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);)
|
||||
|
||||
style:
|
||||
style: ## Check code style
|
||||
@echo ">> checking code style"
|
||||
@! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
|
||||
|
||||
test:
|
||||
test: ## Run tests
|
||||
@echo ">> running tests"
|
||||
@./runtests.sh
|
||||
|
||||
format:
|
||||
@echo ">> formatting code"
|
||||
@$(GO) fmt $(pkgs)
|
||||
format: ## Format source code.
|
||||
gofmt -w -s $(FILES)
|
||||
goimports -local github.com/percona/pmm-managed -l -w $(FILES)
|
||||
|
||||
vet:
|
||||
vet: ## Run vet on Go code
|
||||
@echo ">> vetting code"
|
||||
@$(GO) vet $(pkgs)
|
||||
@$(foreach pkg,$(pkgs), cd $(TOP_DIR)/src/go/$(pkg); go vet ./... ;)
|
||||
|
||||
|
@@ -143,6 +143,30 @@ services:
|
||||
- configsvr1
|
||||
# - configsvr2
|
||||
# - 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:
|
||||
network_mode: host
|
||||
image: ${TEST_MONGODB_FLAVOR}:${TEST_PSMDB_VERSION}
|
||||
@@ -166,6 +190,10 @@ services:
|
||||
- s3-mongo2
|
||||
- s3-mongo3
|
||||
- standalone
|
||||
- postgres9
|
||||
- postgres10
|
||||
- postgres11
|
||||
- postgres12
|
||||
test:
|
||||
build:
|
||||
dockerfile: docker/test/Dockerfile
|
||||
|
@@ -18,7 +18,7 @@ func TestCheckUpdates(t *testing.T) {
|
||||
m := strings.Split(string(body), ";")
|
||||
|
||||
advices := []Advice{
|
||||
Advice{
|
||||
{
|
||||
Hash: m[0],
|
||||
ToolName: m[1],
|
||||
Advice: "There is a new version",
|
||||
|
@@ -23,10 +23,10 @@ const (
|
||||
ipv6PG11Port = "6432"
|
||||
ipv6PG12Port = "6432"
|
||||
|
||||
pg9Container = "pt-pg-summary_postgres9_1"
|
||||
pg10Container = "pt-pg-summary_postgres10_1"
|
||||
pg11Container = "pt-pg-summary_postgres11_1"
|
||||
pg12Container = "pt-pg-summary_postgres12_1"
|
||||
pg9Container = "go_postgres9_1"
|
||||
pg10Container = "go_postgres10_1"
|
||||
pg11Container = "go_postgres11_1"
|
||||
pg12Container = "go_postgres12_1"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@@ -4,7 +4,9 @@ export BASEDIR=$(git rev-parse --show-toplevel)
|
||||
export CHECK_SESSIONS=0
|
||||
cd $BASEDIR
|
||||
|
||||
for dir in $(ls -d pt-*)
|
||||
source ${BASEDIR}/src/go/setenv.sh
|
||||
|
||||
for dir in $(ls -d ./src/go/pt-*)
|
||||
do
|
||||
echo "Running tests at $BASEDIR/$dir"
|
||||
cd $BASEDIR/$dir
|
||||
|
Reference in New Issue
Block a user