Skip to content

Commit

Permalink
print comparison error
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Mar 1, 2024
1 parent 14a0d54 commit 8c1a448
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 3 additions & 1 deletion flow/e2e/postgres/peer_flow_pg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,9 @@ func (s PeerFlowE2ETestSuitePG) Test_Dynamic_Mirror_Config_Via_Signals() {
return s.comparePGTables(srcTable1Name, dstTable1Name, "id,t") == nil
})
e2e.EnvWaitFor(s.t, env, 2*time.Minute, "initial load + normalize 18 records - second table", func() bool {
return s.comparePGTables(srcTable2Name, dstTable2Name, "id,t") == nil
err := s.comparePGTables(srcTable2Name, dstTable2Name, "id,t")
s.t.Log("TEST", err)
return err == nil
})

workflowState = getWorkflowState()
Expand Down
21 changes: 11 additions & 10 deletions flow/e2e/postgres/qrep_flow_pg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/jackc/pgx/v5/pgtype"
"github.com/joho/godotenv"
"github.com/stretchr/testify/require"
"golang.org/x/sync/errgroup"

connpostgres "github.com/PeerDB-io/peer-flow/connectors/postgres"
"github.com/PeerDB-io/peer-flow/e2e"
Expand Down Expand Up @@ -83,16 +84,16 @@ func (s PeerFlowE2ETestSuitePG) setupSourceTable(tableName string, rowCount int)
}

func (s PeerFlowE2ETestSuitePG) comparePGTables(srcSchemaQualified, dstSchemaQualified, selector string) error {
// Execute the two EXCEPT queries
if err := s.compareQuery(srcSchemaQualified, dstSchemaQualified, selector); err != nil {
return err
}
if err := s.compareQuery(dstSchemaQualified, srcSchemaQualified, selector); err != nil {
return err
}

// If no error is returned, then the contents of the two tables are the same
return nil
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
group, _ := errgroup.WithContext(ctx)
group.Go(func() error {
return s.compareQuery(srcSchemaQualified, dstSchemaQualified, selector)
})
group.Go(func() error {
return s.compareQuery(dstSchemaQualified, srcSchemaQualified, selector)
})
return group.Wait()
}

func (s PeerFlowE2ETestSuitePG) checkEnums(srcSchemaQualified, dstSchemaQualified string) error {
Expand Down

0 comments on commit 8c1a448

Please sign in to comment.