'MongoDB to Elasticsearch using Monstache unable to connect getting server selection error:

I am trying to replicate the github repo https://github.com/rwynn/monstache/tree/v6.7.7 however while building the code getting following error. some of the integrations tests are failing with connection error as below, not able to connect to MongoDB, can someone please help how to resolve this issue.

=== RUN   TestInsert
    monstache_test.go:90: server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [{ Addr: localhost:27017, Type: Unknown, 
Last error: connection() error occured during connection handshake: dial tcp [::1]:27017: connectex: No connection could be made because the target machine activ
ely refused it. }, ] }
--- FAIL: TestInsert (30.02s)
=== RUN   TestUpdate
    monstache_test.go:90: server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [{ Addr: localhost:27017, Type: Unknown, 
Last error: connection() error occured during connection handshake: dial tcp [::1]:27017: connectex: No connection could be made because the target machine activ
ely refused it. }, ] }
--- FAIL: TestUpdate (30.02s)
=== RUN   TestDelete
    monstache_test.go:90: server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [{ Addr: localhost:27017, Type: Unknown, 
Last error: connection() error occured during connection handshake: dial tcp [::1]:27017: connectex: No connection could be made because the target machine activ
ely refused it. }, ] }
--- FAIL: TestDelete (30.02s)
=== RUN   TestDropDatabase
    monstache_test.go:90: server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [{ Addr: localhost:27017, Type: Unknown, 
Last error: connection() error occured during connection handshake: dial tcp [::1]:27017: connectex: No connection could be made because the target machine activ
ely refused it. }, ] }
--- FAIL: TestDropDatabase (30.03s)
=== RUN   TestDropCollection
    monstache_test.go:90: server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [{ Addr: localhost:27017, Type: Unknown, 
Last error: connection() error occured during connection handshake: dial tcp [::1]:27017: connectex: No connection could be made because the target machine activ
ely refused it. }, ] }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source