Skip to content

Commit

Permalink
Update log_format_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
godrei committed Jun 22, 2023
1 parent f92de72 commit eee3f5f
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions _tests/integration/log_format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,35 @@ func TestConsoleLogCanBeRestoredFromJSONLog(t *testing.T) {
}

func createConsoleLog(t *testing.T, workflow string) (string, error) {
execCmd := exec.Command(binPath(), "setup")
outBytes, err := execCmd.CombinedOutput()
require.NoError(t, err, string(outBytes))
{
cmd := exec.Command(binPath(), "setup")
outBytes, err := cmd.CombinedOutput()
require.NoError(t, err, string(outBytes))
}

{
cmd := exec.Command(binPath(), ":analytics", "off")
outBytes, err := cmd.CombinedOutput()
require.NoError(t, err, string(outBytes))
}

cmd := exec.Command(binPath(), "run", workflow, "--config", "log_format_test_bitrise.yml")
out, err := cmd.CombinedOutput()
return string(out), err
}

func createJSONLog(t *testing.T, workflow string) ([]byte, error) {
execCmd := exec.Command(binPath(), "setup")
outBytes, err := execCmd.CombinedOutput()
require.NoError(t, err, string(outBytes))
{
cmd := exec.Command(binPath(), "setup")
outBytes, err := cmd.CombinedOutput()
require.NoError(t, err, string(outBytes))
}

{
cmd := exec.Command(binPath(), ":analytics", "off")
outBytes, err := cmd.CombinedOutput()
require.NoError(t, err, string(outBytes))
}

cmd := exec.Command(binPath(), "run", workflow, "--config", "log_format_test_bitrise.yml", "--output-format", "json")
return cmd.CombinedOutput()
Expand Down Expand Up @@ -165,7 +181,7 @@ func convertStepFinishedEventLog(line []byte) (string, error) {
if err != nil {
return "", err
}

var buf bytes.Buffer
logger := log.NewLogger(log.LoggerOpts{LoggerType: log.ConsoleLogger, Writer: &buf})
logger.PrintStepFinishedEvent(eventLog.Content)
Expand Down

0 comments on commit eee3f5f

Please sign in to comment.