-
Notifications
You must be signed in to change notification settings - Fork 647
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 functional tests to honor MINT_DATA_DIR properly #879
Conversation
b8faa4b
to
e0685b4
Compare
functional_tests.go
Outdated
@@ -6244,7 +6255,7 @@ func testPutObjectWithContextV2() { | |||
} | |||
defer c.RemoveBucket(bucketName) | |||
bufSize := thirtyThreeKiB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bufSize can also be picked from the map based on filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
755c181
to
ac44e96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
functional_tests.go
Outdated
if getDataDir() != "" { | ||
filepath = getDataDir() + "/" + filename | ||
func getFilePath(filename string) (fp string) { | ||
if mintDataDir == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want to return just the file name (filepath
here), when mintDataDir
is empty, ""
, i.e when env var MINT_DATA_DIR is not defined?
If true, then having just return filepath.Join(mintDataDir, filename)
would be good enough for both cases (when env var is defined and not defined).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we are not returning the file name we are only returning if the filepath can be constructed. because this function is meaningless.. outside of mint context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the function name to avoid confusion.
functional_tests.go
Outdated
@@ -617,9 +628,9 @@ func testPutObjectWithMetadata() { | |||
return | |||
} | |||
|
|||
// Generate data using 2 parts | |||
// Generate data for using 2 parts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra space before 2
ac44e96
to
0d63a4b
Compare
@ebozduman please take a look again. |
functional_tests.go
Outdated
@@ -617,9 +623,10 @@ func testPutObjectWithMetadata() { | |||
return | |||
} | |||
|
|||
// Generate data using 2 parts | |||
// Generate data for using 2 parts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment can be more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
0d63a4b
to
fb811e5
Compare
Removed all unnecessary comments @kannappanr @ebozduman can you review again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failing with MINT_DATA_DIR set. Need to verify it is my setup or the code.
fb811e5
to
a8cc825
Compare
objectName := fmt.Sprintf("test-file-%v", rand.Uint32()) | ||
args["objectName"] = objectName | ||
|
||
offset := length / 2 | ||
if _, err := tempfile.Seek(int64(offset), 0); err != nil { | ||
if _, err = tempfile.Seek(int64(offset), 0); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not do os.Remove at line 3845
@@ -1525,11 +1528,6 @@ func testFPutObject() { | |||
return | |||
} | |||
|
|||
err = os.Remove(fName + ".gtar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be removed. This code is needed, otherwise it will leave an extra file in the /mint/data directory
getDataReader() now doesn't rely on multiple arguments for different behavior, instead getDataReader() always returns a reader depending on the input file name. This map of file name maps to size which correspond with MINT_DATA_DIR requirements. This fixes a whole bunch of bugs in interpretation, repetition in tests.
a8cc825
to
ed7e6fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it on my local setup with MINT_DATA_DIR set. LGTM
getDataReader() now doesn't rely on multiple arguments
for different behavior, instead getDataReader() always
returns a reader depending on the input file name.
This map of file name maps to size which correspond with
MINT_DATA_DIR requirements.
This fixes a whole bunch of bugs in interpretation, repetition
in tests.