Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…o BUX-396/EndpointForCreatingContact
  • Loading branch information
Nazarii-4chain committed Feb 29, 2024
2 parents 55bdf54 + e1f01c0 commit e71e271
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
2 changes: 1 addition & 1 deletion config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ db:
datastore:
# enable datastore debug mode
debug: false
# datastore engine - sqlite/postgres/mysql/mongodb
# datastore engine - sqlite/postgresql/mysql/mongodb (experimental)
engine: sqlite
# prefix for all tables
table_prefix: xapi
Expand Down
28 changes: 8 additions & 20 deletions engine/spv_wallet_engine_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package engine
import (
"context"
"fmt"
"sync"
"testing"
"time"

Expand All @@ -16,6 +15,7 @@ import (
"github.com/dolthub/go-mysql-server/server"
embeddedPostgres "github.com/fergusstrange/embedded-postgres"
"github.com/mrz1836/go-datastore"
"github.com/rs/zerolog/log"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/tryvium-travels/memongo"
Expand Down Expand Up @@ -61,28 +61,15 @@ type EmbeddedDBTestSuite struct {
MongoServer *memongo.Server // In-memory Mongo server
MySQLServer *server.Server // In-memory MySQL server
PostgresqlServer *embeddedPostgres.EmbeddedPostgres // In-memory Postgresql server
quit chan interface{} // Channel for exiting
wg sync.WaitGroup // Workgroup for managing goroutines
}

// serveMySQL will serve the MySQL server and exit if quit
func (ts *EmbeddedDBTestSuite) serveMySQL() {
defer ts.wg.Done()

logger := zerolog.Nop()

for {
err := ts.MySQLServer.Start()
if err != nil {
select {
case <-ts.quit:
logger.Debug().Msg("MySQL channel has closed")
return
default:
logger.Error().Msgf("mysql server error: %s", err.Error())
}
}
err := ts.MySQLServer.Start()
if err != nil {
log.Error().Msgf("mysql server error: %s", err.Error())
}

}

// SetupSuite runs at the start of the suite
Expand All @@ -97,8 +84,6 @@ func (ts *EmbeddedDBTestSuite) SetupSuite() {
}

// Don't block, serve the MySQL instance
ts.quit = make(chan interface{})
ts.wg.Add(1)
go ts.serveMySQL()

// Create the Mongo server
Expand Down Expand Up @@ -301,6 +286,9 @@ func (ts *EmbeddedDBTestSuite) createTestClient(ctx context.Context, database da
opts = append(opts, WithMinercraft(&chainstate.MinerCraftBase{}))

// Create the client
testLogger := zerolog.Nop()
opts = append(opts, WithLogger(&testLogger))

if tc.client, err = NewClient(ctx, opts...); err != nil {
return nil, err
}
Expand Down

0 comments on commit e71e271

Please sign in to comment.