-
Notifications
You must be signed in to change notification settings - Fork 31
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
Support for acadia profile #205
Changes from 9 commits
25e53dd
63f6e04
9c94779
06302dd
ba16321
a3d2f2f
b13652b
d2be699
c2a6cbb
8fbbd26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,54 +40,75 @@ func TestGetRequestedCapacity(t *testing.T) { | |
testCases := []struct { | ||
testCaseName string | ||
capRange *csi.CapacityRange | ||
profileName string | ||
expectedValue int64 | ||
expectedError error | ||
}{ | ||
{ | ||
testCaseName: "Check minimum size supported by volume provider in case of nil passed as input for sdp profile", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add negative tests as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added few cases covering nil but we cannot pass negative value to this parameter. IDeally this will come from the k8s parsing form PVC.It is not allowed |
||
capRange: nil, | ||
profileName: "sdp", | ||
expectedValue: MinimumSDPVolumeSizeInBytes, | ||
expectedError: nil, | ||
}, | ||
{ | ||
testCaseName: "Check minimum size supported by volume provider in case of lower value passed as input for sdp profile", | ||
capRange: &csi.CapacityRange{RequiredBytes: 1024}, | ||
profileName: "sdp", | ||
expectedValue: MinimumSDPVolumeSizeInBytes, | ||
expectedError: nil, | ||
}, | ||
{ | ||
testCaseName: "Check minimum size supported by volume provider in case of nil passed as input", | ||
capRange: &csi.CapacityRange{}, | ||
profileName: "custom", | ||
expectedValue: utils.MinimumVolumeSizeInBytes, | ||
expectedError: nil, | ||
}, | ||
{ | ||
testCaseName: "Capacity range is nil", | ||
capRange: nil, | ||
profileName: "general-purpose", | ||
expectedValue: utils.MinimumVolumeSizeInBytes, | ||
expectedError: nil, | ||
}, | ||
{ | ||
testCaseName: "Check minimum size supported by volume provider", | ||
capRange: &csi.CapacityRange{RequiredBytes: 1024, | ||
LimitBytes: utils.MinimumVolumeSizeInBytes}, | ||
profileName: "custom", | ||
expectedValue: utils.MinimumVolumeSizeInBytes, | ||
expectedError: nil, | ||
}, | ||
{ | ||
testCaseName: "Check size passed as actual value", | ||
capRange: &csi.CapacityRange{RequiredBytes: 11811160064, | ||
LimitBytes: utils.MinimumVolumeSizeInBytes + utils.MinimumVolumeSizeInBytes}, // MinimumVolumeSizeInBytes->10737418240 | ||
profileName: "custom", | ||
expectedValue: 11811160064, | ||
expectedError: nil, | ||
}, | ||
{ | ||
testCaseName: "Expected error check-success", | ||
capRange: &csi.CapacityRange{RequiredBytes: 1073741824 * 30, | ||
LimitBytes: utils.MinimumVolumeSizeInBytes}, // MinimumVolumeSizeInBytes->10737418240 | ||
profileName: "custom", | ||
expectedValue: 0, | ||
expectedError: fmt.Errorf("limit bytes %v is less than required bytes %v", utils.MinimumVolumeSizeInBytes, 1073741824*30), | ||
}, | ||
{ | ||
testCaseName: "Expected error check against limit byte-success", | ||
capRange: &csi.CapacityRange{RequiredBytes: utils.MinimumVolumeSizeInBytes - 100, | ||
LimitBytes: 10737418230}, // MinimumVolumeSizeInBytes->10737418240 | ||
profileName: "custom", | ||
expectedValue: 0, | ||
expectedError: fmt.Errorf("limit bytes %v is less than minimum volume size: %v", 10737418230, utils.MinimumVolumeSizeInBytes), | ||
}, | ||
} | ||
|
||
for _, testcase := range testCases { | ||
t.Run(testcase.testCaseName, func(t *testing.T) { | ||
sizeCap, err := getRequestedCapacity(testcase.capRange) | ||
sizeCap, err := getRequestedCapacity(testcase.capRange, testcase.profileName) | ||
if testcase.expectedError != nil { | ||
assert.Equal(t, err, testcase.expectedError) | ||
} else { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
why we can't use
volume.VPCVolume.Profile.Name
instead of creating new variable?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.
@arahamad I had initially used that only but wanted to avoid multiple nil checks. I have now put generic nil check to avoid this. Thanks for the comments.