Skip to content

Commit

Permalink
Merge pull request #358 from bruin-data/fix/integration-continue-test-2
Browse files Browse the repository at this point in the history
fix integration test state
  • Loading branch information
y-bruin authored Dec 24, 2024
2 parents 93d54ce + 1545180 commit 12f7dad
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions integration-tests/integration-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,12 @@ func main() {
Version: "1.0.0",
CompatibilityHash: "6a4a1598e729fea65eeaa889aa0602be3133a465bcdde84843ff02954497ff65",
})
if err := copyFile(filepath.Join(currentFolder, "./player_summary.sql"), filepath.Join(currentFolder, "continue/assets/player_summary.sql")); err != nil {
fmt.Println("Failed to copy file:", err)

if err := setupForContinue(currentFolder); err != nil {
fmt.Println("Failed to setup test case for continue:", err)
os.Exit(1)
}

expectExitCode("run --continue ./continue", 0)
expectedState(filepath.Join(currentFolder, "/logs/runs/continue_duckdb"), &scheduler.PipelineState{
Parameters: scheduler.RunConfig{
Expand Down Expand Up @@ -205,6 +207,11 @@ func main() {
Version: "1.0.0",
CompatibilityHash: "6a4a1598e729fea65eeaa889aa0602be3133a465bcdde84843ff02954497ff65",
})

if err := copyFile(filepath.Join(currentFolder, "./player_summary.sql.bak"), filepath.Join(currentFolder, "continue/assets/player_summary.sql")); err != nil {
fmt.Println("Failed to copy file:", err)
os.Exit(1)
}
}

func expectOutputIncludes(command string, code int, contains []string) {
Expand Down Expand Up @@ -347,6 +354,19 @@ func readState(dir string) *scheduler.PipelineState {
return state
}

func setupForContinue(currentFolder string) error {
if err := copyFile(filepath.Join(currentFolder, "continue/assets/player_summary.sql"), filepath.Join(currentFolder, "./player_summary.sql.bak")); err != nil {
fmt.Println("Failed to copy file:", err)
return err
}

if err := copyFile(filepath.Join(currentFolder, "player_summary.sql"), filepath.Join(currentFolder, "continue/assets/player_summary.sql")); err != nil {
fmt.Println("Failed to copy file:", err)
return err
}
return nil
}

func expectedState(dir string, expected *scheduler.PipelineState) {
state := readState(dir)
if state.Parameters.Workers != expected.Parameters.Workers {
Expand Down Expand Up @@ -392,5 +412,5 @@ func expectedState(dir string, expected *scheduler.PipelineState) {
os.Exit(1)
}

fmt.Println("Passed")
fmt.Println("Passed State Match")
}

0 comments on commit 12f7dad

Please sign in to comment.