Skip to content

Commit

Permalink
enable for other workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-fischer committed Jan 18, 2025
1 parent 58e00bb commit 5eb5e37
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 5 deletions.
137 changes: 133 additions & 4 deletions .github/workflows/golang-test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,51 @@ jobs:
if: matrix.store == 'mysql'
run: docker pull mlsmaycon/warmed-mysql:8

- name: Start Postgres
if: matrix.store == 'postgres'
run: |
docker run -d \
-e POSTGRES_USER=root \
-e POSTGRES_PASSWORD=netbird \
-e POSTGRES_DB=netbird \
-p 5432:5432 \
--name my-postgres \
postgres:15-alpine
- name: Wait for Postgres
if: matrix.store == 'postgres'
run: |
for i in {1..10}; do
if nc -z localhost 5432; then
break
fi
echo "Waiting for Postgres..."
sleep 3
done
- name: Start MySQL
if: matrix.store == 'mysql'
run: |
docker run -d \
-e MYSQL_ROOT_PASSWORD=netbird \
-e MYSQL_DATABASE=netbird \
-p 3306:3306 \
--name my-mysql \
mlsmaycon/warmed-mysql:8
- name: Wait for MySQL
if: matrix.store == 'mysql'
run: |
for i in {1..10}; do
if nc -z localhost 3306; then
break
fi
echo "Waiting for MySQL..."
sleep 3
done
- name: Test
run: CGO_ENABLED=1 GOARCH=${{ matrix.arch }} NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true go test -tags devcert -run=^$ -bench=. -exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' -timeout 20m ./...
run: CGO_ENABLED=1 GOARCH=${{ matrix.arch }} NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true go test -tags devcert -run=^$ -bench=. -exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE,NETBIRD_STORE_ENGINE_POSTGRES_DSN,NETBIRD_STORE_ENGINE_MYSQL_DSN' -timeout 20m ./...

api_benchmark:
needs: [ build-cache ]
Expand Down Expand Up @@ -368,9 +411,52 @@ jobs:
- name: download mysql image
if: matrix.store == 'mysql'
run: docker pull mlsmaycon/warmed-mysql:8


- name: Start Postgres
if: matrix.store == 'postgres'
run: |
docker run -d \
-e POSTGRES_USER=root \
-e POSTGRES_PASSWORD=netbird \
-e POSTGRES_DB=netbird \
-p 5432:5432 \
--name my-postgres \
postgres:15-alpine
- name: Wait for Postgres
if: matrix.store == 'postgres'
run: |
for i in {1..10}; do
if nc -z localhost 5432; then
break
fi
echo "Waiting for Postgres..."
sleep 3
done
- name: Start MySQL
if: matrix.store == 'mysql'
run: |
docker run -d \
-e MYSQL_ROOT_PASSWORD=netbird \
-e MYSQL_DATABASE=netbird \
-p 3306:3306 \
--name my-mysql \
mlsmaycon/warmed-mysql:8
- name: Wait for MySQL
if: matrix.store == 'mysql'
run: |
for i in {1..10}; do
if nc -z localhost 3306; then
break
fi
echo "Waiting for MySQL..."
sleep 3
done
- name: Test
run: CGO_ENABLED=1 GOARCH=${{ matrix.arch }} NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true go test -tags=benchmark -run=^$ -bench=. -exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' -timeout 10m $(go list ./... | grep /management)
run: CGO_ENABLED=1 GOARCH=${{ matrix.arch }} NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true go test -tags=benchmark -run=^$ -bench=. -exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE,NETBIRD_STORE_ENGINE_POSTGRES_DSN,NETBIRD_STORE_ENGINE_MYSQL_DSN' -timeout 10m $(go list ./... | grep /management)

api_integration_test:
needs: [ build-cache ]
Expand Down Expand Up @@ -418,8 +504,51 @@ jobs:
- name: check git status
run: git --no-pager diff --exit-code

- name: Start Postgres
if: matrix.store == 'postgres'
run: |
docker run -d \
-e POSTGRES_USER=root \
-e POSTGRES_PASSWORD=netbird \
-e POSTGRES_DB=netbird \
-p 5432:5432 \
--name my-postgres \
postgres:15-alpine
- name: Wait for Postgres
if: matrix.store == 'postgres'
run: |
for i in {1..10}; do
if nc -z localhost 5432; then
break
fi
echo "Waiting for Postgres..."
sleep 3
done
- name: Start MySQL
if: matrix.store == 'mysql'
run: |
docker run -d \
-e MYSQL_ROOT_PASSWORD=netbird \
-e MYSQL_DATABASE=netbird \
-p 3306:3306 \
--name my-mysql \
mlsmaycon/warmed-mysql:8
- name: Wait for MySQL
if: matrix.store == 'mysql'
run: |
for i in {1..10}; do
if nc -z localhost 3306; then
break
fi
echo "Waiting for MySQL..."
sleep 3
done
- name: Test
run: CGO_ENABLED=1 GOARCH=${{ matrix.arch }} NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true go test -p 1 -exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' -timeout 10m -tags=integration $(go list ./... | grep /management)
run: CGO_ENABLED=1 GOARCH=${{ matrix.arch }} NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true go test -p 1 -exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE,NETBIRD_STORE_ENGINE_POSTGRES_DSN,NETBIRD_STORE_ENGINE_MYSQL_DSN' -timeout 10m -tags=integration $(go list ./... | grep /management)

test_client_on_docker:
needs: [ build-cache ]
Expand Down
2 changes: 1 addition & 1 deletion management/server/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func getSqlStoreEngine(ctx context.Context, store *SqlStore, kind Engine) (Store
return nil, nil, fmt.Errorf("%s is not set", mysqlDsnEnv)
}

db, err := gorm.Open(mysql.Open(dsn+"?charset=utf8&parseTime=True&loc=Local"), getGormConfig())
db, err := gorm.Open(mysql.Open(dsn), getGormConfig())
if err != nil {
return nil, cleanUp, fmt.Errorf("failed to open mysql connection: %v", err)
}
Expand Down

0 comments on commit 5eb5e37

Please sign in to comment.