Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
  • Loading branch information
jsign committed Jun 27, 2022
1 parent 251be4d commit df19b56
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
4 changes: 1 addition & 3 deletions internal/tableland/impl/mesa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,6 @@ func jsonEq(
require.NoError(t, err)

gotJSON := string(b)
fmt.Printf("GOT JSON: %s\n", gotJSON)
fmt.Printf("EXP JSON: %s\n", expJSON)

var o1 interface{}
var o2 interface{}
Expand Down Expand Up @@ -714,7 +712,7 @@ func setup(
)
require.NoError(t, err)

userStore, err := user.New(url + "&_mode=ro")
userStore, err := user.New(url)
require.NoError(t, err)

tbld := NewTablelandMesa(
Expand Down
16 changes: 7 additions & 9 deletions pkg/eventprocessor/impl/eventprocessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func TestQueryWithWrongTableTarget(t *testing.T) {
Error: &expErr,
TableID: nil,
}
require.Eventually(t, checkReceipts(t, expReceipt), time.Second*10, time.Millisecond*100)
require.Eventually(t, checkReceipts(t, expReceipt), time.Second*5, time.Millisecond*100)
}

func TestSetController(t *testing.T) {
Expand Down Expand Up @@ -294,7 +294,7 @@ type contractCalls struct {
}

type dbReader func(string) []int64
type contractRunSQLBlockSender func(...[]string) []common.Hash
type contractRunSQLBlockSender func([]string) []common.Hash
type contractCreateTableSender func(string) common.Hash
type contractSetControllerSender func(controller common.Address) common.Hash
type contractTransferFromSender func(controller common.Address) common.Hash
Expand Down Expand Up @@ -325,15 +325,13 @@ func setup(t *testing.T) (
require.NoError(t, err)

ctx := context.Background()
contractSendRunSQL := func(queries ...[]string) []common.Hash {
contractSendRunSQL := func(queries []string) []common.Hash {
var txnHashes []common.Hash
for _, qs := range queries {
for _, q := range qs {
txn, err := sc.RunSQL(authOpts, authOpts.From, big.NewInt(1), q)
for _, q := range queries {
txn, err := sc.RunSQL(authOpts, authOpts.From, big.NewInt(1), q)

require.NoError(t, err)
txnHashes = append(txnHashes, txn.Hash())
}
require.NoError(t, err)
txnHashes = append(txnHashes, txn.Hash())
}
backend.Commit()
return txnHashes
Expand Down
2 changes: 1 addition & 1 deletion pkg/sqlstore/impl/system/internal/db/acl.sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"
)

const getAclByTableAndController = `-- name: GetAclByTableAndController :one
const getAclByTableAndController = `
SELECT table_id, controller, privileges, created_at, updated_at, chain_id FROM system_acl WHERE chain_id = ?3 AND table_id = ?2 AND upper(controller) LIKE upper(?1)
`

Expand Down
2 changes: 1 addition & 1 deletion pkg/sqlstore/impl/system/internal/db/receipt.sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
)

const getReceipt = `-- name: GetReceipt :one
const getReceipt = `
SELECT chain_id, block_number, index_in_block, txn_hash, error, table_id from system_txn_receipts WHERE chain_id=?1 and txn_hash=?2
`

Expand Down
7 changes: 2 additions & 5 deletions pkg/sqlstore/impl/system/internal/db/registry.sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"
)

const getTable = `-- name: GetTable :one
const getTable = `
SELECT created_at, id, structure, controller, prefix, chain_id FROM registry WHERE chain_id =?1 AND id = ?2
`

Expand All @@ -31,7 +31,7 @@ func (q *Queries) GetTable(ctx context.Context, arg GetTableParams) (Registry, e
return i, err
}

const getTablesByController = `-- name: GetTablesByController :many
const getTablesByController = `
SELECT created_at, id, structure, controller, prefix, chain_id FROM registry WHERE chain_id=?1 AND upper(controller) LIKE upper(?2)
`

Expand Down Expand Up @@ -63,9 +63,6 @@ func (q *Queries) GetTablesByController(ctx context.Context, arg GetTablesByCont
i.CreatedAt = time.Unix(createdAtUnix, 0)
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
Expand Down

0 comments on commit df19b56

Please sign in to comment.