Fix benchmarks to stop using deprecated constructor

pull/16/head
Vinícius Garcia 2022-01-20 18:46:19 -03:00
parent e4c2151fad
commit 6c90673bef
3 changed files with 19 additions and 6 deletions

View File

@ -16,6 +16,7 @@ bench:
lint: setup
@$(GOBIN)/golint -set_exit_status -min_confidence 0.9 $(path) $(args)
@go vet $(path) $(args)
@make -C benchmarks
@echo "Golint & Go Vet found no problems on your code!"
mock: setup

6
benchmarks/Makefile Normal file
View File

@ -0,0 +1,6 @@
GOBIN=$(shell go env GOPATH)/bin
lint:
@$(GOBIN)/golint -set_exit_status -min_confidence 0.9 ./...
@go vet ./...

View File

@ -31,9 +31,12 @@ func BenchmarkInsert(b *testing.B) {
}
b.Run("ksql/sql-adapter", func(b *testing.B) {
ksqlDB, err := ksql.New(driver, connStr, ksql.Config{
MaxOpenConns: 1,
})
db, err := sql.Open(driver, connStr)
if err != nil {
b.Fatalf("error connecting to database: %s", err)
}
db.SetMaxOpenConns(1)
ksqlDB, err := ksql.NewWithAdapter(ksql.NewSQLAdapter(db), driver)
if err != nil {
b.Fatalf("error creating ksql client: %s", err)
}
@ -284,9 +287,12 @@ func BenchmarkQuery(b *testing.B) {
}
b.Run("ksql/sql-adapter", func(b *testing.B) {
ksqlDB, err := ksql.New(driver, connStr, ksql.Config{
MaxOpenConns: 1,
})
db, err := sql.Open(driver, connStr)
if err != nil {
b.Fatalf("error connecting to database: %s", err)
}
db.SetMaxOpenConns(1)
ksqlDB, err := ksql.NewWithAdapter(ksql.NewSQLAdapter(db), driver)
if err != nil {
b.Fatalf("error creating ksql client: %s", err)
}