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 Elasticsearch indexer

The Elasticsearch-backed indexer implementation defines its own go-check test suite that embeds the shared indexer test suite and provides setup and teardown methods that are specific to the Elasticsearch implementation.

Each the tests in the suite use the same ElasticSearchIndexer instance that is initialized once with the following suite setup method:

func (s *ElasticSearchTestSuite) SetUpSuite(c *gc.C) {
    nodeList := os.Getenv("ES_NODES")
    if nodeList == "" {
        c.Skip("Missing ES_NODES envvar; skipping elasticsearch-backed index test suite")
    }

    idx, err := NewElasticSearchIndexer(strings.Split(nodeList, ",")) c.Assert(err, gc.IsNil) s.SetIndexer(idx) // Keep track of the concrete indexer ...
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