Skip to content

Commit

Permalink
darcys22GH-49 adjust build flags
Browse files Browse the repository at this point in the history
use the integration tag for all the integration tests
which should exclude them all when that tag is missing

use a compound constraint to further segregate:

- the mysql integration tests which are not yet working,
  they require additional investment to spin up a mysql
  db out-of-process; and

- the secure connection tests which are failing on my
  machine, likely due to pollution of test context
  between tests and my local environment:

    secure_connection_test.go:130: Node Version request
    failed: rpc error: code = Unavailable desc = connection
    error: desc = "transport: authentication handshake
    failed: x509: certificate is valid for 127.0.0.1, not 0.0.0.0"

  after running the integration test suite I see the following
  untracked files:

    Untracked files:
        godbledger/rpc/~/
        godbledger/~/
        tests/~/

  I notice that tests/~/Library/ledgerdb/config.toml contains
  configuration pointing to a data direction outside the source
  folder in my local home folder, which makes me uncertain
  which config is being used during the test

  for now I am segregating the secure tests in order to have
  a clean integration test run while I refactor the way
  test data, directory, and config is managed to improve
  isolation between test cases and the local environment
  • Loading branch information
davidalpert committed May 8, 2021
1 parent 7e0f3a9 commit 977c27d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
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 977c27d

Please sign in to comment.