diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 9c35b74e0..989403cd8 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -29,30 +29,6 @@ jobs: with: go-version: "1.23.1" - # - name: Build - # run: | - # cd yb-voyager - # go build -v ./... - - # # required by godror driver used in the tests - # - name: Install Oracle Instant Clients - # run: | - # # Download and install the YB APT repository package - # wget https://s3.us-west-2.amazonaws.com/downloads.yugabyte.com/repos/reporpms/yb-apt-repo_1.0.0_all.deb - # sudo apt-get install -y ./yb-apt-repo_1.0.0_all.deb - # sudo apt-get update -y - - # # Install Oracle Instant Client packages using the defined version - # sudo apt-get install -y oracle-instantclient-tools=${{ env.ORACLE_INSTANT_CLIENT_VERSION }} - # sudo apt-get install -y oracle-instantclient-basic=${{ env.ORACLE_INSTANT_CLIENT_VERSION }} - # sudo apt-get install -y oracle-instantclient-devel=${{ env.ORACLE_INSTANT_CLIENT_VERSION }} - # sudo apt-get install -y oracle-instantclient-jdbc=${{ env.ORACLE_INSTANT_CLIENT_VERSION }} - # sudo apt-get install -y oracle-instantclient-sqlplus=${{ env.ORACLE_INSTANT_CLIENT_VERSION }} - - # # Clean up the YB APT repository package - # sudo apt-get remove -y yb-apt-repo - # rm -f yb-apt-repo_1.0.0_all.deb - - name: Run installer script to setup voyager and dependencies for running integration tests run: | cd installer_scripts diff --git a/yb-voyager/test/utils/cmdutils.go b/yb-voyager/test/utils/cmdutils.go index 343c8e54e..c7713e2a9 100644 --- a/yb-voyager/test/utils/cmdutils.go +++ b/yb-voyager/test/utils/cmdutils.go @@ -2,13 +2,10 @@ package testutils import ( "fmt" - "io" - "log" "os" "os/exec" "strconv" "strings" - "sync" "time" "github.com/yugabyte/yb-voyager/yb-voyager/src/utils" @@ -69,62 +66,32 @@ func RunVoyagerCommmand(container testcontainers.TestContainer, } } - // 1) Build the command to run. + // Build the command to run. cmdArgs = append(connectionArgs, cmdArgs...) cmdStr := fmt.Sprintf("yb-voyager %s %s", cmdName, strings.Join(cmdArgs, " ")) cmd := exec.Command("/bin/bash", "-c", cmdStr) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + // don't send to callhome for tests cmd.Env = append(os.Environ(), "YB_VOYAGER_SEND_DIAGNOSTICS=false") - // 2) Get the stdout and stderr pipes. - stdoutPipe, err := cmd.StdoutPipe() - if err != nil { - return fmt.Errorf("failed to get stdout pipe: %w", err) - } - stderrPipe, err := cmd.StderrPipe() - if err != nil { - return fmt.Errorf("failed to get stderr pipe: %w", err) - } - - // 3) Start the voyager command asynchronously. + // Start the voyager command asynchronously. if err = cmd.Start(); err != nil { return fmt.Errorf("failed to start voyager command: %w", err) } - // 4) Launch goroutines to stream output live to console. - var wg sync.WaitGroup - wg.Add(2) - - go func() { - defer wg.Done() - // Copy stdout to os.Stdout. - if _, err := io.Copy(os.Stdout, stdoutPipe); err != nil { - log.Printf("Error copying stdout: %v", err) - } - }() - - go func() { - defer wg.Done() - // Copy stderr to os.Stderr. - if _, err := io.Copy(os.Stderr, stderrPipe); err != nil { - log.Printf("Error copying stderr: %v", err) - } - }() - - // 5) Execute the during-command function (if provided). + // Execute the during command function (if provided). if doDuringCmd != nil { // delay for 2 seconds to ensure the command has started. time.Sleep(2 * time.Second) doDuringCmd() } - // 6) Wait for the voyager command to finish. + // Wait for the voyager command to finish. if err := cmd.Wait(); err != nil { return fmt.Errorf("voyager command exited with error: %w", err) } - // 7) Wait for the output goroutines to complete. - wg.Wait() - return nil }