fix: support large output with --enable-live-ouput (#1139)

* fix: support large output with --enable-live-ouput

This replaces Scanner with ReadString to handle large amount of data returned by helm ouptut when executing diff action

- Changing pkg/helmexec/runner_test.go TestLiveOutput test, adding test with large amount of data, reproducing the issue before applying this fix
- Changing pkg/helmexec/runner.go Scanner with Readstring

Resolves https://github.com/helmfile/helmfile/issues/893

Signed-off-by: Franck Labatut <franck.labatut@ubisoft.com>

* fix: prevent data race

Signed-off-by: Franck Labatut <franck.labatut@ubisoft.com>

---------

Signed-off-by: Franck Labatut <franck.labatut@ubisoft.com>
This commit is contained in:
flabatut
2023-11-12 06:45:08 +08:00
committed by GitHub
parent e756712e80
commit b8a729d8c4
3 changed files with 29709 additions and 7 deletions
+10
View File
@@ -3,6 +3,7 @@ package helmexec
import (
"bytes"
"context"
_ "embed"
"os/exec"
"reflect"
"strings"
@@ -48,6 +49,9 @@ func TestShellRunner_Execute(t *testing.T) {
}
}
//go:embed testdata/live-output-data.txt
var liveOutputData string
func TestLiveOutput(t *testing.T) {
tests := []struct {
name string
@@ -55,6 +59,12 @@ func TestLiveOutput(t *testing.T) {
wantW string
wantErr bool
}{
{
name: "live_output_data",
cmd: exec.Command("cat", "testdata/live-output-data.txt"),
wantW: liveOutputData,
wantErr: false,
},
{
name: "echo_template",
cmd: exec.Command("echo", "template"),