Skip to content

Commit

Permalink
Small fixes in models field tags and updated error messages in hasura…
Browse files Browse the repository at this point in the history
… integration test..
  • Loading branch information
vvuwei committed Apr 25, 2023
1 parent b6e04c9 commit 1c8b1f4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions cmd/mempool/hasura_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ func TestIntegration_HasuraMetadata(t *testing.T) {
// Go through `expectedMetadata` and assert that each object
// in that array is in `metadata` with corresponding columns.
for _, expectedTable := range expectedMetadata.Tables {
metadataTable, err := getTableColumns(metadata, expectedTable.Name, "user") // todo: read role from config
metadataTableColumns, err := getTableColumns(metadata, expectedTable.Name, "user") // todo: read role from config
if err != nil {
t.Fatalf("Erro with searching expectedTable in metadata: %e", err)
t.Fatalf("Error with searching expectedTable in metadata: %s\n%e", expectedTable.Name, err)
}

if !elementsMatch(expectedTable, metadataTable) {
t.Errorf("Table columns do not match: %s", expectedTable.Name)
if !elementsMatch(expectedTable, metadataTableColumns) {
t.Errorf(
"Table columns do not match: %s\nexpected: %s\nactual: %s",
expectedTable.Name,
expectedTable.Columns,
metadataTableColumns,
)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/mempool/models/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ type Proposal struct {
tableName struct{} `pg:"proposals"`
MempoolOperation
Period int64 `json:"period"`
Proposals string `json:"proposal"`
Proposals string `json:"proposal" pg:"proposals"`
}
1 change: 1 addition & 0 deletions cmd/mempool/models/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package models
type Transaction struct {
//nolint
tableName struct{} `pg:"transactions"`

MempoolOperation
Source string `json:"source" index:"transaction_source_idx"`
Fee int64 `json:"fee,string"`
Expand Down

0 comments on commit 1c8b1f4

Please sign in to comment.