Skip to content

Commit

Permalink
Merge pull request #138 from davidalpert/GH-49-adjust-build-flags
Browse files Browse the repository at this point in the history
GH-49 adjust build flags
  • Loading branch information
darcys22 authored May 10, 2021
2 parents 7e0f3a9 + d373b0f commit c3f9b65
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 40 deletions.
73 changes: 37 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,40 @@ jobs:
run: go run utils/ci.go build
- name: Test
run: go run utils/ci.go test --integration -v
mysqltest:
strategy:
fail-fast: false # dont' want one scenario failing to deprive us of feedback on the others
matrix:
go-version: [1.14.x, 1.15.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_USER: godbledger
MYSQL_PASSWORD: password
MYSQL_DATABASE: ledger
MYSQL_ROOT_PASSWORD: password
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s
steps:
- name: Verify MySQL connection
env:
PORT: ${{ job.services.mysql.ports[3306] }}
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
sleep 1
done
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: go run utils/ci.go build
- name: Test
run: go run utils/ci.go test --mysql -v
# TODO: these mysql test currently bypass the end-to-end test pattern effectively testing only that configuration is loaded
# mysqltest:
# strategy:
# fail-fast: false # dont' want one scenario failing to deprive us of feedback on the others
# matrix:
# go-version: [1.14.x, 1.15.x]
# os: [ubuntu-latest]
# runs-on: ${{ matrix.os }}
# services:
# mysql:
# image: mysql:5.7
# env:
# MYSQL_USER: godbledger
# MYSQL_PASSWORD: password
# MYSQL_DATABASE: ledger
# MYSQL_ROOT_PASSWORD: password
# ports:
# - 3306
# options: --health-cmd="mysqladmin ping" --health-interval=10s
# steps:
# - name: Verify MySQL connection
# env:
# PORT: ${{ job.services.mysql.ports[3306] }}
# run: |
# while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
# sleep 1
# done
# - name: Install Go
# uses: actions/setup-go@v2
# with:
# go-version: ${{ matrix.go-version }}
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Build
# run: go run utils/ci.go build
# - name: Test
# run: go run utils/ci.go test --mysql -v
4 changes: 3 additions & 1 deletion tests/mysql_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Package mysql performs full a end-to-end test for GoDBLedger specifically using a mysql backend,
// including spinning up a server and making sure its running, and sending test data to verify

// +build mysql
// +build integration,mysql

package tests

Expand All @@ -16,6 +16,8 @@ import (
)

func TestMySQL(t *testing.T) {
assert.Fail(t, "MYSQL tests are not currently supported; testing mysql cannot be done in-process and requires additional work to enable")
return

// Create a config from the defaults which would usually be created by the CLI library
set := flag.NewFlagSet("test", 0)
Expand Down
2 changes: 1 addition & 1 deletion tests/secure_connection_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// secure connection test establishes a connection using mutual tls, and sending test transaction to verify

// +build integration
// +build integration,secure

package tests

Expand Down
8 changes: 6 additions & 2 deletions utils/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ func doTest(cmdline []string) {
coverage := flag.Bool("coverage", false, "Whether to record code coverage")
verbose := flag.Bool("v", false, "Whether to log verbosely")
integration := flag.Bool("integration", false, "Whether to run integration tests")
mysql := flag.Bool("mysql", false, "Whether to run mysql integration tests")
mysql := flag.Bool("mysql", false, "Whether to run mysql integration tests (not currently supported)")
secure := flag.Bool("secure", false, "Whether to run secure integration tests")
flag.CommandLine.Parse(cmdline)
env := build.Env()

Expand All @@ -339,7 +340,10 @@ func doTest(cmdline []string) {
gotest.Args = append(gotest.Args, "-tags=integration")
}
if *mysql {
gotest.Args = append(gotest.Args, "-tags=mysql")
gotest.Args = append(gotest.Args, "-tags=integration,mysql")
}
if *secure {
gotest.Args = append(gotest.Args, "-tags=integration,secure")
}
if *verbose {
gotest.Args = append(gotest.Args, "-v")
Expand Down

0 comments on commit c3f9b65

Please sign in to comment.