Documentation ¶
Overview ¶
Provides mongodb connection for tests only
Index ¶
- func GetBufDialer(listener *bufconn.Listener) func(context.Context, string) (net.Conn, error)
- func InitGrpcTLSWithBuffConn(ctx context.Context, t *testing.T, allowPurge bool) *clientResult
- func MongoDbConnect(ctx context.Context, timeoutSec int) (*mongo.Client, *dockertest.Pool, *dockertest.Resource)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBufDialer ¶
func InitGrpcTLSWithBuffConn ¶
func MongoDbConnect ¶
func MongoDbConnect(ctx context.Context, timeoutSec int) (*mongo.Client, *dockertest.Pool, *dockertest.Resource)
Based on Dockertest
Example ¶
package main import ( "context" "fmt" "time" "github.com/rsachdeva/illuminatingdeposits-grpc/testserver" ) func main() { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() _, pool, resource := testserver.MongoDbConnect(ctx, 10) err := pool.Purge(resource) fmt.Println("ExampleMongoDbConnect err is", err) }
Output: ExampleMongoDbConnect err is <nil>
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.