Example #1
0
func NewTestConfig() Config {
	return Config{
		DatabaseUrl:            test.DatabaseUrl(),
		StellarCoreDatabaseUrl: test.StellarCoreDatabaseUrl(),
		RateLimit:              throttled.PerHour(1000),
	}
}
Example #2
0
func OpenTestDatabase() *sqlx.DB {

	result, err := sqlx.Open("postgres", test.DatabaseUrl())

	if err != nil {
		log.Panic(err)
	}
	return result
}
Example #3
0
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)
		})
	})
}
Example #4
0
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")
		})
	})
}