-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mysql] Add integration test scaffolding
- Loading branch information
1 parent
6a06abf
commit fb3f52a
Showing
5 changed files
with
88 additions
and
49 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
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,14 @@ | ||
package main | ||
|
||
import ( | ||
"log/slog" | ||
"os" | ||
|
||
"github.com/lmittmann/tint" | ||
) | ||
|
||
func main() { | ||
os.Setenv("TZ", "UTC") | ||
slog.SetDefault(slog.New(tint.NewHandler(os.Stderr, &tint.Options{Level: slog.LevelInfo}))) | ||
|
||
} |
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,46 @@ | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/artie-labs/reader/lib" | ||
"github.com/artie-labs/transfer/lib/cdc/util" | ||
) | ||
|
||
func GetPayload(message lib.RawMessage) util.SchemaEventPayload { | ||
payloadTyped, ok := message.GetPayload().(util.SchemaEventPayload) | ||
if !ok { | ||
panic("payload is not of type util.SchemaEventPayload") | ||
} | ||
return payloadTyped | ||
} | ||
|
||
func CheckDifference(name, expected, actual string) bool { | ||
if expected == actual { | ||
return false | ||
} | ||
expectedLines := strings.Split(expected, "\n") | ||
actualLines := strings.Split(actual, "\n") | ||
fmt.Printf("Expected %s:\n", name) | ||
fmt.Println("--------------------------------------------------------------------------------") | ||
for i, line := range expectedLines { | ||
prefix := " " | ||
if i >= len(actualLines) || line != actualLines[i] { | ||
prefix = ">" | ||
} | ||
fmt.Println(prefix + line) | ||
} | ||
fmt.Println("--------------------------------------------------------------------------------") | ||
fmt.Printf("Actual %s:\n", name) | ||
fmt.Println("--------------------------------------------------------------------------------") | ||
for i, line := range actualLines { | ||
prefix := " " | ||
if i >= len(expectedLines) || line != expectedLines[i] { | ||
prefix = ">" | ||
} | ||
fmt.Println(prefix + line) | ||
} | ||
fmt.Println("--------------------------------------------------------------------------------") | ||
return true | ||
} |