Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps committed Nov 25, 2024
1 parent 494f5d4 commit 0b2c2c5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
7 changes: 4 additions & 3 deletions go/dbinfo/dbinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func run(out io.Writer, cfg Config) error {
type TableColumn struct {
Name string `json:"name"`
Type string `json:"type"`
KeyType string `json:"keyType"`
KeyType string `json:"keyType,omitempty"`
IsNullable bool `json:"isNullable"`
Extra string `json:"extra"`
Extra string `json:"extra,omitempty"`
}

type TableInfo struct {
Expand Down Expand Up @@ -110,7 +110,8 @@ func Get(cfg Config) (*Info, error) {
}

dbInfo := &Info{
Tables: tableInfo,
FileType: "dbinfo",
Tables: tableInfo,
}
return dbInfo, nil
}
Expand Down
6 changes: 2 additions & 4 deletions go/dbinfo/dbinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import (
)

func TestDBInfoRowCount(t *testing.T) {
si, err := Load("../testdata/sakila-schema-info.json")
si, err := Load("../testdata/sakila-dbinfo.json")
require.NoError(t, err)
require.NotNil(t, si)
require.NotEmpty(t, si.Tables)
require.Len(t, si.Tables, 16)
require.Len(t, si.Tables, 23)
var tables []string
for _, table := range si.Tables {
tables = append(tables, table.Name)
Expand All @@ -41,8 +41,6 @@ func TestDBInfoRowCount(t *testing.T) {
require.Equal(t, 6, table.Rows)
case "film":
require.Equal(t, 1000, table.Rows)
default:
require.Positive(t, table.Rows, "table %s has no rows", table.Name)
}
}
}
2 changes: 1 addition & 1 deletion go/summarize/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestGetFileType(t *testing.T) {
expectedType: unknownFile,
},
{
filename: "../testdata/sakila-schema-info.json",
filename: "../testdata/sakila-dbinfo.json",
expectedType: dbInfoFile,
},
{
Expand Down
2 changes: 1 addition & 1 deletion go/testdata/sakila-dbinfo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"fileType": "",
"fileType": "dbinfo",
"tables": [
{
"name": "inventory",
Expand Down

0 comments on commit 0b2c2c5

Please sign in to comment.