Skip to content

Commit

Permalink
Move pkg/testutils and pkg/jsonschema into internal (#418)
Browse files Browse the repository at this point in the history
I think moving these two packages should be pretty uncontroversial since
they're used for testing and validation and we don't expect them to be
imported others.

Part of #399
  • Loading branch information
ryanslade authored Oct 21, 2024
1 parent 12ae369 commit 01ff6ac
Show file tree
Hide file tree
Showing 36 changed files with 31 additions and 17 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions pkg/testutils/util.go → internal/testutils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/postgres"
"github.com/testcontainers/testcontainers-go/wait"

"github.com/xataio/pgroll/pkg/roll"
"github.com/xataio/pgroll/pkg/state"
)
Expand Down
3 changes: 2 additions & 1 deletion pkg/db/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
"testing"
"time"

"github.com/xataio/pgroll/internal/testutils"

"github.com/stretchr/testify/require"
"github.com/xataio/pgroll/pkg/db"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/migrations/op_add_column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

"github.com/stretchr/testify/assert"

"github.com/xataio/pgroll/internal/testutils"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/roll"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestAddColumn(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/migrations/op_alter_column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"database/sql"
"testing"

"github.com/xataio/pgroll/internal/testutils"

"github.com/oapi-codegen/nullable"
"github.com/stretchr/testify/assert"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestAlterColumnMultipleSubOperations(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/migrations/op_change_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"database/sql"
"testing"

"github.com/xataio/pgroll/internal/testutils"

"github.com/stretchr/testify/assert"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/roll"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestChangeColumnType(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/migrations/op_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import (
"slices"
"testing"

"github.com/xataio/pgroll/internal/testutils"

"github.com/lib/pq"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/roll"
"github.com/xataio/pgroll/pkg/testutils"
)

type TestCase struct {
Expand Down
6 changes: 3 additions & 3 deletions pkg/migrations/op_create_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"database/sql"
"testing"

"github.com/stretchr/testify/assert"

"github.com/xataio/pgroll/internal/testutils"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/roll"
"github.com/xataio/pgroll/pkg/testutils"

"github.com/stretchr/testify/assert"
)

func TestCreateTable(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/migrations/op_drop_constraint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"database/sql"
"testing"

"github.com/xataio/pgroll/internal/testutils"

"github.com/stretchr/testify/assert"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestDropConstraint(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/migrations/op_drop_not_null_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"database/sql"
"testing"

"github.com/xataio/pgroll/internal/testutils"

"github.com/stretchr/testify/assert"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestDropNotNull(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/migrations/op_raw_sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"database/sql"
"testing"

"github.com/xataio/pgroll/internal/testutils"

"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/roll"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestRawSQL(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/migrations/op_set_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"database/sql"
"testing"

"github.com/xataio/pgroll/internal/testutils"

"github.com/stretchr/testify/assert"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestSetCheckConstraint(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/migrations/op_set_fk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"database/sql"
"testing"

"github.com/xataio/pgroll/internal/testutils"

"github.com/stretchr/testify/assert"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestSetForeignKey(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/migrations/op_set_notnull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (

"github.com/stretchr/testify/assert"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/testutils"

"github.com/xataio/pgroll/internal/testutils"
)

func TestSetNotNull(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/migrations/op_set_unique_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"testing"

"github.com/stretchr/testify/assert"

"github.com/xataio/pgroll/internal/testutils"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestSetColumnUnique(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/roll/execute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/xataio/pgroll/internal/testutils"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/roll"
"github.com/xataio/pgroll/pkg/state"
"github.com/xataio/pgroll/pkg/testutils"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion pkg/state/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/xataio/pgroll/internal/testutils"
"github.com/xataio/pgroll/pkg/migrations"
"github.com/xataio/pgroll/pkg/schema"
"github.com/xataio/pgroll/pkg/state"
"github.com/xataio/pgroll/pkg/testutils"
)

func TestMain(m *testing.M) {
Expand Down

0 comments on commit 01ff6ac

Please sign in to comment.