Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Setting up a test suite for the CockroachDB implementation

To create and wire the test suite for the CockroachDB implementation, we will follow exactly the same steps that we did for the in-memory implementation. The first step is to define a test suite that embeds the shared graphtest.SuiteBase type and register it with go test:

var _ = gc.Suite(new(CockroachDBGraphTestSuite))

type CockroachDBGraphTestSuite struct {
    graphtest.SuiteBase
    db *sql.DB
}

// Register our test-suite with go test.
func Test(t *testing.T) { gc.TestingT(t) }

Then, we need to provide a setup method for the test suite that will create a new CockroachDB graph instance and wire it to the base suite. Following the testing paradigm we discussed in Chapter 4, The Art of ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content