Skip to content

Commit

Permalink
remove output file segmeneter mock by migrating the one test that use…
Browse files Browse the repository at this point in the history
…d it to 180 test
  • Loading branch information
williammoran committed Apr 27, 2024
1 parent ce70d7e commit 6c3aa8f
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 222 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ go 1.22

require (
github.com/alexflint/go-arg v1.4.3
github.com/golang/mock v1.4.4
github.com/hashicorp/go-multierror v1.1.1
github.com/hexops/gotextdiff v1.0.3
github.com/jackc/pgconn v1.14.3
github.com/jackc/pgtype v1.14.3
github.com/jackc/pgx/v4 v4.18.3
github.com/pkg/errors v0.9.1
Expand All @@ -21,7 +21,6 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.3 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
Expand Down Expand Up @@ -227,7 +225,6 @@ golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
Expand Down
61 changes: 61 additions & 0 deletions lib/format/pgsql8/oneeighty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,67 @@ func TestOneEighty(t *testing.T) {
Max: util.Some(9876543),
Increment: util.Some(2),
}},
}, {
Name: "other_function_schema",
Description: "used as part of column_default_function_schema to test cross-schema default func references",
Owner: role,
Functions: []*ir.Function{
{
Name: "test",
Owner: role,
Description: "Test Function",
CachePolicy: "VOLATILE",
Returns: "integer",
Definitions: []*ir.FunctionDefinition{{
SqlFormat: ir.SqlFormatPgsql8,
Language: "sql",
Text: "SELECT 1",
}},
},
},
},
{
Name: "column_default_function_schema",
Description: "test column default is a function works properly",
Owner: role,
Functions: []*ir.Function{
{
Name: "test",
Owner: role,
Description: "Test Function 1",
CachePolicy: "VOLATILE",
Returns: "integer",
Definitions: []*ir.FunctionDefinition{{
SqlFormat: ir.SqlFormatPgsql8,
Language: "sql",
Text: "SELECT 1",
}},
},
},
Tables: []*ir.Table{
{
Name: "rate_group",
Owner: role,
PrimaryKeyName: "rate_group_pkey",
PrimaryKey: []string{"rate_group_id"},
Columns: []*ir.Column{
{Name: "rate_group_id", Type: "integer", Nullable: false, Default: "column_default_function_schema.test()"},
{Name: "rate_group_name", Type: "character varying(100)", Nullable: true},
{Name: "rate_group_enabled", Type: "boolean", Nullable: false, Default: "true"},
},
},
{
Name: "rate_group_n",
Owner: role,
PrimaryKeyName: "rate_group_n_pkey",
PrimaryKey: []string{"rate_group_id"},
Columns: []*ir.Column{
{Name: "rate_group_id", Type: "integer", Nullable: false, Default: "other_function_schema.test()"},
{Name: "rate_group_name", Type: "character varying(100)", Nullable: true},
{Name: "rate_group_enabled", Type: "boolean", Nullable: false, Default: "true"},
},
},
},
},
{
Name: "public",
Expand Down
85 changes: 0 additions & 85 deletions lib/format/pgsql8/pgsql8_column_default_is_function_test.go

This file was deleted.

2 changes: 0 additions & 2 deletions lib/output/output_file_segmenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"github.com/dbsteward/dbsteward/lib/util"
)

//go:generate $ROOTDIR/run _mockgen OutputFileSegmenter

const CommentLinePrefix = "--"

type ToSql interface {
Expand Down
130 changes: 0 additions & 130 deletions lib/output/output_file_segmenter_mock.go

This file was deleted.

0 comments on commit 6c3aa8f

Please sign in to comment.