Skip to content

Commit

Permalink
Merge branch 'main' into vcolombo/clean-keep
Browse files Browse the repository at this point in the history
  • Loading branch information
victorcolombo authored Oct 6, 2023
2 parents 9d7b744 + 545aa53 commit 0ec8c30
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/server/api_container/server/api_container_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ func getTextRepresentation(reader io.Reader, lineCount int) (*string, error) {
return nil, stacktrace.NewError("File has no text representation because '%v' is not printable", char)
}
}
textRepresentation.WriteString(line)
textRepresentation.WriteString(fmt.Sprintf("%s\n", line))
}

if err := scanner.Err(); err != nil {
Expand Down
15 changes: 15 additions & 0 deletions core/server/api_container/server/api_container_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings"
"github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_interface/objects/port_spec"
"github.com/stretchr/testify/require"
"strings"
"testing"
)

Expand All @@ -35,3 +36,17 @@ func TestOneToOneApiAndPortSpecProtoMapping(t *testing.T) {
seenPortSpecProtos[portSpecProto] = apiPortProto
}
}

func TestGetTextRepresentation(t *testing.T) {
input := `my
line
input
`
expectedOutput := `my
line
`
output, err := getTextRepresentation(strings.NewReader(input), 2)
require.NoError(t, err)
require.NotNil(t, output)
require.Equal(t, expectedOutput, *output)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
archiveDirectoryTestPattern = "upload-test-golang-"
archiveSubDirectoryTestPattern = "sub-folder-"
archiveFileTestPattern = "test-file-"
archiveTestFileContent = "This file is for testing purposes."
archiveTestFileContent = "This file is for testing purposes.\n"

numberOfTempTestFilesToCreateInSubDir = 3
numberOfTempTestFilesToCreateInArchiveDir = 1
Expand Down

0 comments on commit 0ec8c30

Please sign in to comment.