Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: treat size value as megabytes #2030

Merged
merged 3 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ func (t *directoryPersistentDirectoryTestCase) Assert(typeValue builtin_argument

size, err := directoryStarlark.GetSizeOrDefault()
require.Nil(t, err)
require.Equal(t, testPersistentDirectorySize, size)
require.Equal(t, testPersistentDirectorySizeInBytes, size)
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ var (
testPublicPortProtocol = port_spec.TransportProtocol_TCP
testPublicApplicationProtocol = "https"

testFilesArtifactPath1 = "path/to/file/1"
testFilesArtifactName1 = "file_1"
testFilesArtifactPath2 = "path/to/file/2"
testFilesArtifactName2 = "file_2"
testPersistentDirectoryPath = "path/to/persistent/dir"
testPersistentDirectoryKey = "persistent-dir-test"
testPersistentDirectorySize = int64(30)
testFilesArtifactPath1 = "path/to/file/1"
testFilesArtifactName1 = "file_1"
testFilesArtifactPath2 = "path/to/file/2"
testFilesArtifactName2 = "file_2"
testPersistentDirectoryPath = "path/to/persistent/dir"
testPersistentDirectoryKey = "persistent-dir-test"
testPersistentDirectorySize = int64(30)
testPersistentDirectorySizeInBytes = testPersistentDirectorySize * 1024 * 1024

testEntryPointSlice = []string{
"127.0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const (
PersistentKeyAttr = "persistent_key"
SizeKeyAttr = "size"

atleastOneMegabyte = 1
atleastOneMegabyte = 1
megaByteToByteMultiplier = 1024 * 1024
)

func NewDirectoryType() *kurtosis_type_constructor.KurtosisTypeConstructor {
Expand Down Expand Up @@ -159,5 +160,5 @@ func (directory *Directory) GetSizeOrDefault() (int64, *startosis_errors.Interpr
if !ok {
return 0, startosis_errors.NewInterpretationError("Couldn't convert size '%v' to int64", size)
}
return sizeInt64, nil
return sizeInt64 * megaByteToByteMultiplier, nil
}
Loading