-
Notifications
You must be signed in to change notification settings - Fork 315
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
Add integration test cases of file share #1037
base: development
Are you sure you want to change the base?
Conversation
a601155
to
6bbbca4
Compare
457d398
to
c267bf3
Compare
30b2191
to
1f249e8
Compare
Codecov Report
@@ Coverage Diff @@
## development #1037 +/- ##
============================================
Coverage 34.66% 34.66%
============================================
Files 97 97
Lines 17878 17878
============================================
Hits 6197 6197
Misses 10805 10805
Partials 876 876 |
@@ -299,7 +299,7 @@ func TestCreateFileShareAcl(t *testing.T) { | |||
t.Error(err) | |||
return | |||
} | |||
|
|||
fileShareAcl.Status = "available" |
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.
Should our test case include FielShareAcl.Statu = "unavailable" to for Create File Share ACL?
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.
Only positive scenarios are covered in this cycle of execution. FileshareAcl.Status = "error" is there not "unavailable"
@@ -493,15 +493,15 @@ func TestDeleteFileShareProfile(t *testing.T) { | |||
|
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.
Did you check if the new profile API (though it is just param changes), will have any effect on this?
@@ -493,15 +493,15 @@ func TestDeleteFileShareProfile(t *testing.T) { | |||
|
|||
t.Run("Should return 200 if everything works well", func(t *testing.T) { | |||
mockClient := new(dbtest.Client) | |||
mockClient.On("GetProfile", c.NewAdminContext(), "2f9c0a04-66ef-11e7-ade2-43158893e017").Return( | |||
mockClient.On("GetProfile", c.NewAdminContext(), "3f9c0a04-66ef-11e7-ade2-43158893e017").Return( |
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 is the ID change required for tests? Should not it be consistent or some generator which generates ID and that is persisted across the tests?
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.
Those are all compulsorily needed to mock functions GetProfile function, it was using block profile, So now i have changed to use file profiles.
@@ -163,7 +163,7 @@ func TestCreateFileShareAcl(t *testing.T) { | |||
if err != nil { | |||
t.Errorf("failed to create fileshare acl, err is %v\n", err) | |||
} | |||
|
|||
result.Status = "available" |
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.
Same comment as above, Should we have a test case for unavailable?
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.
only +ve scenarios covered for IT
File share integration test cases | ||
*/ | ||
|
||
func TestClientCreateFileProfile(t *testing.T) { |
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.
I think this function should be split and one part should be made generic. Just pass the StorageType as Block, File or Object..It should create profile with the cutomeProperties. Caller will then do the match with the expected
return | ||
} | ||
|
||
var expected = &SampleFileShares[0] |
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.
is the expected value an array or struct or just a string?
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.
its interface
@@ -299,7 +299,7 @@ func TestCreateFileShareAcl(t *testing.T) { | |||
t.Error(err) | |||
return | |||
} | |||
|
|||
fileShareAcl.Status = "available" |
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.
Should we have a test case for unavailable test case?
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.
same as above
@@ -493,15 +493,15 @@ func TestDeleteFileShareProfile(t *testing.T) { | |||
|
|||
t.Run("Should return 200 if everything works well", func(t *testing.T) { | |||
mockClient := new(dbtest.Client) | |||
mockClient.On("GetProfile", c.NewAdminContext(), "2f9c0a04-66ef-11e7-ade2-43158893e017").Return( | |||
mockClient.On("GetProfile", c.NewAdminContext(), "3f9c0a04-66ef-11e7-ade2-43158893e017").Return( |
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.
These changes are only for ID..Why tests should have changes related to ID..Shoud we have generator function for ID which can be used across the tests?
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.
data collection file is already there, we are reusing those. In this test case it was using block profile. So we have changed to file profile id
@@ -546,3 +546,258 @@ func TestClientFailoverReplication(t *testing.T) { | |||
t.Log("Disable volume replication not ready!") | |||
} |
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.
Should not this file be separated for different features? like client_fs_test, client_block_test , client_relication_test....?
@joseph-v @Shruthi-1MN Can we please consider this?
@@ -58,19 +58,19 @@ var ( | |||
SampleFileShareProfiles = []model.ProfileSpec{ | |||
{ | |||
BaseModel: &model.BaseModel{ | |||
Id: "1106b972-66ef-11e7-b172-db03f3689c9c", | |||
Id: "2106b972-66ef-11e7-b172-db03f3689c9c", |
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.
Same as above...Why should there be these chages for ID? Let's discuss it. Generator and persisted across tests
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.
Same as above file profile has been created earlier it was using block profile
cb0bdc5
to
ec3c2b0
Compare
6741eb5
to
1522acd
Compare
1522acd
to
f17877a
Compare
What this PR does / why we need it:
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Release note: