From 9a5136190f2c2cf2d2aec56aee653809001943cb Mon Sep 17 00:00:00 2001 From: Noah Hilverling Date: Mon, 13 May 2019 14:40:51 +0200 Subject: [PATCH] Prepare repository merge --- .gitignore => connection/.gitignore | 0 connection/.gitlab-ci.yml | 30 +++++++++++++++++++ README.md => connection/README.md | 0 coverage.sh => connection/coverage.sh | 0 mysql.go => connection/mysql.go | 2 +- mysql_test.go => connection/mysql_test.go | 2 +- mysql_utils.go => connection/mysql_utils.go | 4 +-- .../mysql_utils_test.go | 2 +- prometheus.go => connection/prometheus.go | 2 +- redis.go => connection/redis.go | 2 +- .../redis_pipeliner.go | 2 +- redis_pubsub.go => connection/redis_pubsub.go | 2 +- .../redis_pubsub_test.go | 2 +- redis_test.go => connection/redis_test.go | 2 +- test_db.sql => connection/test_db.sql | 0 15 files changed, 41 insertions(+), 11 deletions(-) rename .gitignore => connection/.gitignore (100%) create mode 100644 connection/.gitlab-ci.yml rename README.md => connection/README.md (100%) rename coverage.sh => connection/coverage.sh (100%) rename mysql.go => connection/mysql.go (99%) rename mysql_test.go => connection/mysql_test.go (99%) rename mysql_utils.go => connection/mysql_utils.go (99%) rename mysql_utils_test.go => connection/mysql_utils_test.go (98%) rename prometheus.go => connection/prometheus.go (96%) rename redis.go => connection/redis.go (99%) rename redis_pipeliner.go => connection/redis_pipeliner.go (96%) rename redis_pubsub.go => connection/redis_pubsub.go (97%) rename redis_pubsub_test.go => connection/redis_pubsub_test.go (97%) rename redis_test.go => connection/redis_test.go (99%) rename test_db.sql => connection/test_db.sql (100%) diff --git a/.gitignore b/connection/.gitignore similarity index 100% rename from .gitignore rename to connection/.gitignore diff --git a/connection/.gitlab-ci.yml b/connection/.gitlab-ci.yml new file mode 100644 index 00000000..56b155c4 --- /dev/null +++ b/connection/.gitlab-ci.yml @@ -0,0 +1,30 @@ +image: golang:latest + +variables: + REPO_NAME: git.icinga.com/icingadb/icingadb-connection + +before_script: + - mkdir -p $GOPATH/src/$(dirname $REPO_NAME) + - ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME + - cd $GOPATH/src/$REPO_NAME + - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@git.icinga.com/".insteadOf "https://git.icinga.com/" + - go get -t ./... + +stages: + - test + - coverage + +test: + stage: test + script: + - go fmt $(go list ./... | grep -v /vendor/) + - go vet $(go list ./... | grep -v /vendor/) + - go test -race $(go list ./... | grep -v /vendor/) -cover + +coverage: + stage: coverage + script: + - ./coverage.sh + artifacts: + paths: + - coverage.html diff --git a/README.md b/connection/README.md similarity index 100% rename from README.md rename to connection/README.md diff --git a/coverage.sh b/connection/coverage.sh similarity index 100% rename from coverage.sh rename to connection/coverage.sh diff --git a/mysql.go b/connection/mysql.go similarity index 99% rename from mysql.go rename to connection/mysql.go index 3514c67b..06cbef43 100644 --- a/mysql.go +++ b/connection/mysql.go @@ -1,4 +1,4 @@ -package icingadb_connection +package connection import ( "container/list" diff --git a/mysql_test.go b/connection/mysql_test.go similarity index 99% rename from mysql_test.go rename to connection/mysql_test.go index b2ca129f..fafd95e9 100644 --- a/mysql_test.go +++ b/connection/mysql_test.go @@ -1,4 +1,4 @@ -package icingadb_connection +package connection import ( "context" diff --git a/mysql_utils.go b/connection/mysql_utils.go similarity index 99% rename from mysql_utils.go rename to connection/mysql_utils.go index d596e510..8220d5e9 100644 --- a/mysql_utils.go +++ b/connection/mysql_utils.go @@ -1,4 +1,4 @@ -package icingadb_connection +package connection import ( "database/sql" @@ -40,7 +40,7 @@ func mkMysql(dbType string, dbDsn string) (*sql.DB, error) { mysql.SetLogger(oldlog.New(ioutil.Discard, "", 0)) - db.SetMaxOpenConns(100) + db.SetMaxOpenConns(50) db.SetMaxIdleConns(0) return db, nil diff --git a/mysql_utils_test.go b/connection/mysql_utils_test.go similarity index 98% rename from mysql_utils_test.go rename to connection/mysql_utils_test.go index b21bc171..8b5346ae 100644 --- a/mysql_utils_test.go +++ b/connection/mysql_utils_test.go @@ -1,4 +1,4 @@ -package icingadb_connection +package connection import ( "errors" diff --git a/prometheus.go b/connection/prometheus.go similarity index 96% rename from prometheus.go rename to connection/prometheus.go index 8b9dc482..00094c8d 100644 --- a/prometheus.go +++ b/connection/prometheus.go @@ -1,4 +1,4 @@ -package icingadb_connection +package connection import ( "github.com/prometheus/client_golang/prometheus" diff --git a/redis.go b/connection/redis.go similarity index 99% rename from redis.go rename to connection/redis.go index d71700b6..9e47b651 100644 --- a/redis.go +++ b/connection/redis.go @@ -1,4 +1,4 @@ -package icingadb_connection +package connection import ( "fmt" diff --git a/redis_pipeliner.go b/connection/redis_pipeliner.go similarity index 96% rename from redis_pipeliner.go rename to connection/redis_pipeliner.go index 97e2fbbc..e58e39a3 100644 --- a/redis_pipeliner.go +++ b/connection/redis_pipeliner.go @@ -1,4 +1,4 @@ -package icingadb_connection +package connection import "github.com/go-redis/redis" diff --git a/redis_pubsub.go b/connection/redis_pubsub.go similarity index 97% rename from redis_pubsub.go rename to connection/redis_pubsub.go index 1cedb303..a373ba27 100644 --- a/redis_pubsub.go +++ b/connection/redis_pubsub.go @@ -1,4 +1,4 @@ -package icingadb_connection +package connection import ( "github.com/go-redis/redis" diff --git a/redis_pubsub_test.go b/connection/redis_pubsub_test.go similarity index 97% rename from redis_pubsub_test.go rename to connection/redis_pubsub_test.go index 34f6cbe9..bee59d05 100644 --- a/redis_pubsub_test.go +++ b/connection/redis_pubsub_test.go @@ -1,4 +1,4 @@ -package icingadb_connection +package connection import ( "github.com/go-redis/redis" diff --git a/redis_test.go b/connection/redis_test.go similarity index 99% rename from redis_test.go rename to connection/redis_test.go index 18810aab..edc62339 100644 --- a/redis_test.go +++ b/connection/redis_test.go @@ -1,4 +1,4 @@ -package icingadb_connection +package connection import ( "github.com/go-redis/redis" diff --git a/test_db.sql b/connection/test_db.sql similarity index 100% rename from test_db.sql rename to connection/test_db.sql