func NewTestConfig() Config { return Config{ DatabaseUrl: test.DatabaseUrl(), StellarCoreDatabaseUrl: test.StellarCoreDatabaseUrl(), RateLimit: throttled.PerHour(1000), } }
func OpenTestDatabase() *sqlx.DB { result, err := sqlx.Open("postgres", test.DatabaseUrl()) if err != nil { log.Panic(err) } return result }
func TestStreaming(t *testing.T) { ctx := test.Context() ctx, cancel := context.WithCancel(ctx) db := test.OpenDatabase(test.DatabaseUrl()) Convey("LedgerClosePump", t, func() { Convey("can cancel", func() { pump := NewLedgerClosePump(ctx, db) cancel() _, more := <-pump So(more, ShouldBeFalse) }) }) }
func TestStreaming(t *testing.T) { ctx, log := test.ContextWithLogBuffer() ctx, cancel := context.WithCancel(ctx) db := test.OpenDatabase(test.DatabaseUrl()) Convey("LedgerClosePump", t, func() { Convey("can cancel", func() { pump := NewLedgerClosePump(ctx, db) cancel() _, more := <-pump So(more, ShouldBeFalse) So(log.String(), ShouldContainSubstring, "canceling") }) }) }