-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add syscodes, move creds checking into NewInitializer
- Loading branch information
Showing
4 changed files
with
82 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package pgreplicator | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/inngest/dbcap/internal/test" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestNewInitializer(t *testing.T) { | ||
t.Parallel() | ||
versions := []int{10, 11, 12, 13, 14, 15, 16} | ||
|
||
for _, version := range versions { | ||
v := version // loop capture | ||
|
||
ctx := context.Background() | ||
c, cfg := test.StartPG(t, ctx, test.StartPGOpts{ | ||
Version: v, | ||
DisableLogicalReplication: true, | ||
DisableCreateSlot: true, | ||
}) | ||
|
||
t.Run("It succeeds with the wrong password", func(t *testing.T) { | ||
_, err := NewInitializer(ctx, InitializerOpts{ | ||
AdminConfig: cfg, | ||
}) | ||
require.NoError(t, err) | ||
}) | ||
|
||
cfg.Password = "whatever my guy" | ||
|
||
t.Run("It errors with the wrong password", func(t *testing.T) { | ||
_, err := NewInitializer(ctx, InitializerOpts{ | ||
AdminConfig: cfg, | ||
}) | ||
require.Error(t, err) | ||
}) | ||
|
||
_ = c.Stop(ctx, nil) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters