Skip to content

Commit

Permalink
fix: treat size value as megabytes (#2030)
Browse files Browse the repository at this point in the history
## Description:
We expect(in DOCS) the user to enter value in megabytes but were never
multiplying the value with the megaByteToByte multiplier
  • Loading branch information
h4ck3rk3y authored Jan 9, 2024
1 parent 4ba41ce commit af687cb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
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
}

0 comments on commit af687cb

Please sign in to comment.