From df9fc78d2d026b8db6baf1d0897c996984b14c87 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Mon, 26 Apr 2021 11:01:24 +0200 Subject: [PATCH 1/2] ci: run mysql tests on non-standard port Signed-off-by: Mark Sagi-Kazar --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5fa372f1..d4140108 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,7 @@ jobs: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: dex ports: - - 3306:3306 + - 3306 options: --health-cmd "mysql -proot -e \"show databases;\"" --health-interval 10s --health-timeout 5s --health-retries 5 etcd: @@ -64,7 +64,7 @@ jobs: DEX_MYSQL_USER: root DEX_MYSQL_PASSWORD: root DEX_MYSQL_HOST: 127.0.0.1 - DEX_MYSQL_PORT: 3306 + DEX_MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} DEX_POSTGRES_DATABASE: postgres DEX_POSTGRES_USER: postgres DEX_POSTGRES_PASSWORD: postgres From e2b56d0a09143bfbd54862baf603bd9c1ffdb369 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Mon, 26 Apr 2021 11:09:52 +0200 Subject: [PATCH 2/2] fix(storage/mysql): add missing port to the address Signed-off-by: Mark Sagi-Kazar --- storage/sql/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storage/sql/config.go b/storage/sql/config.go index 0ce0f117..97ec6cb9 100644 --- a/storage/sql/config.go +++ b/storage/sql/config.go @@ -242,6 +242,10 @@ func (s *MySQL) open(logger log.Logger) (*conn, error) { if s.Host[0] != '/' { cfg.Net = "tcp" cfg.Addr = s.Host + + if s.Port != 0 { + cfg.Addr = net.JoinHostPort(s.Host, strconv.Itoa(int(s.Port))) + } } else { cfg.Net = "unix" cfg.Addr = s.Host