-
Notifications
You must be signed in to change notification settings - Fork 88
Automation test for removing user created vmgroup. #1474
Conversation
@@ -49,6 +49,9 @@ const ( | |||
// where --name will be name of the vmgroup | |||
ReplaceVMFromVMgroup = vmdkopsAdmin + "vmgroup vm replace --name=" | |||
|
|||
// AddAccessForVMgroup create access perms on vmgroup | |||
AddAccessForVMgroup = vmdkopsAdmin + "vmgroup access add --name " |
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.
#1381 is also modifying this code pls. check if there is any overlap.
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.
+1
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 needs to be removed.
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.
L#99 is doing the same thing .. Please remove this one.
tests/e2e/vmgroups_test.go
Outdated
misc.SleepForSec(2) | ||
|
||
// Status should be detached | ||
status = verification.VerifyDetachedStatusOnNonDefaultDS(vg.volName2, vg.config.Datastores[1], |
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.
Can't the same VerifyDetachedStatus() be used here? Why have a separate function for the non-default DS, the DS name is being passed anyway.
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.
+1
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 introduce this because most of the existing tests only need to verify volumes created on default datastore and already call function VerifyDetachedStatus(
. By introducing this new function, we can keep those part unchanged. Those two util functions can be used by caller in different cases.
tests/e2e/vmgroups_test.go
Outdated
|
||
out, err = adminutils.AddVMToVMgroup(vg.config.EsxHost, vgTestVMgroup1, vg.config.DockerHostNames[1]) | ||
c.Assert(err, IsNil, Commentf(out)) | ||
misc.LogTestEnd(c.TestName()) |
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 do we need to recreate and add the VMs back? is it for maintaining the test config?
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.
Yes. Just for maintaining the test config.
tests/e2e/vmgroups_test.go
Outdated
// 2. create two volumes for this vmgroup, one is on default datastore, and the other is on non-default datastore | ||
// 3. verify mount/unmount for this volume | ||
// 4. after unmount, verify the volume is detached for both volumes | ||
// 5. remove VMs from this vmgroup, and remove the vmgroup with "--remove-volume" option |
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.
with or without the option.
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.
tests/e2e/vmgroups_test.go
Outdated
|
||
out, err = adminutils.RemoveVMFromVMgroup(vg.config.EsxHost, vgTestVMgroup1, vg.config.DockerHostNames[1]) | ||
c.Assert(err, IsNil, Commentf(out)) | ||
|
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.
If possible, please combine them as to me it seems that we are removing VMs from the same vmgroup.
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.
Here we do remove VMs from same vmgroup, and it is what we need to do here.
tests/e2e/vmgroups_test.go
Outdated
out, err = adminutils.RemoveVMFromVMgroup(vg.config.EsxHost, vgTestVMgroup1, vg.config.DockerHostNames[1]) | ||
c.Assert(err, IsNil, Commentf(out)) | ||
|
||
log.Printf("Removing test vmgroup %s", vgTestVMgroup1) |
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.
Minor: We do not really need this statement as DeleteVMgroup method itself has log message.
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.
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.
Test looks good.
I have some refactoring comments tagged as minor. It doesn't affect the test case as such but just to avoid code repetition.
Another comment is about the sleep added in test. I think it is not needed. If yes, please add a comment.
tests/e2e/vmgroups_test.go
Outdated
@@ -46,6 +47,7 @@ type VmGroupTest struct { | |||
volName1 string | |||
volName2 string | |||
volName3 string | |||
volName4 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.
This isn't because of your change but this should have been a slice instead. You might wanna handle it if it is trivial.
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.
tests/e2e/vmgroups_test.go
Outdated
out, err := adminutils.AddCreateAccessForVMgroup(vg.config.EsxHost, vgTestVMgroup1, vg.config.Datastores[1]) | ||
c.Assert(err, IsNil, Commentf(out)) | ||
|
||
cmd := adminconst.GetAccessForVMgroup + vgTestVMgroup1 |
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 is a verification step after access has been added. Might wanna wrap it into a util. If we always do this after adding the access, you might wanna add these steps to AddCreateAccessForVMgroup util so that the test steps itself are 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.
This is not a verification step, remove this.
tests/e2e/vmgroups_test.go
Outdated
log.Printf(out) | ||
} | ||
|
||
misc.SleepForSec(2) |
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 this sleep? Does it take time for access to be added? if so please comment.
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 copied from existing code, and verified that this is not needed. So I remove the sleep.
tests/e2e/vmgroups_test.go
Outdated
c.Assert(err, IsNil, Commentf(out)) | ||
|
||
// Docker may not have completed the detach yet with the host. | ||
misc.SleepForSec(2) |
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.
ExecContainer fires a container with --rm flag. So this detach should happen instantly. I am not sure if a sleep is needed here. Are we hitting a race without this sleep?
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.
tests/e2e/vmgroups_test.go
Outdated
misc.SleepForSec(2) | ||
|
||
// Status should be detached | ||
status = verification.VerifyDetachedStatusOnNonDefaultDS(vg.volName2, vg.config.Datastores[1], |
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.
+1
tests/e2e/vmgroups_test.go
Outdated
out, err = adminutils.RemoveVMFromVMgroup(vg.config.EsxHost, vgTestVMgroup1, vg.config.DockerHostNames[0]) | ||
c.Assert(err, IsNil, Commentf(out)) | ||
|
||
out, err = adminutils.RemoveVMFromVMgroup(vg.config.EsxHost, vgTestVMgroup1, vg.config.DockerHostNames[1]) |
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.
Minor: wrap this removal and assert in a loop.
tests/e2e/vmgroups_test.go
Outdated
|
||
out, err = verification.GetVMGroupForVolume(vg.config.EsxHost, vg.volName2) | ||
log.Println("GetVMGroupForVolume return out[%s] err[%s] for volume %s", out, err, vg.volName2) | ||
c.Assert(err.Error(), Equals, "exit status 1", Commentf("volume %s should be removed", vg.volName2)) |
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.
minor: these 3 repeating lines can be wrapped after you the volume name as slice.
tests/e2e/vmgroups_test.go
Outdated
out, err = adminutils.AddVMToVMgroup(vg.config.EsxHost, vgTestVMgroup1, vg.config.DockerHostNames[0]) | ||
c.Assert(err, IsNil, Commentf(out)) | ||
|
||
out, err = adminutils.AddVMToVMgroup(vg.config.EsxHost, vgTestVMgroup1, vg.config.DockerHostNames[1]) |
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 be wrapped in a loop
@@ -152,6 +155,29 @@ func VerifyDetachedStatus(name, hostName, esxName string) bool { | |||
return false | |||
} | |||
|
|||
// VerifyDetachedStatusOnNonDefaultDS - For volume on non-default DS, | |||
// check if the status gets detached within the timeout | |||
func VerifyDetachedStatusOnNonDefaultDS(name, datastore, hostName, esxName string) bool { |
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.
Do we need this since we already have a util to verify detached status?
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.
Agree, the existing function should be used.
const maxAttempt = 60 | ||
for attempt := 0; attempt < maxAttempt; attempt++ { | ||
misc.SleepForSec(2) | ||
status := getVolumeStatusHost(name+"@"+datastore, hostName) |
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.
The only difference between this util and VerifyDetachedStatus is the datastore arg which is used to construct a fully qualified name to get volume status from docker host.
If it is worth, please put the common part of these utils into a func which can be called from these utils.
I still think we can use VerifyDetachedStatus, unless we are worried about same volume names on different datastores.
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.
@@ -152,6 +155,29 @@ func VerifyDetachedStatus(name, hostName, esxName string) bool { | |||
return false | |||
} | |||
|
|||
// VerifyDetachedStatusOnNonDefaultDS - For volume on non-default DS, | |||
// check if the status gets detached within the timeout | |||
func VerifyDetachedStatusOnNonDefaultDS(name, datastore, hostName, esxName string) bool { |
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.
Agree, the existing function should be used.
tests/e2e/vmgroups_test.go
Outdated
log.Println("GetVMGroupForVolume return out[%s] err[%s] for volume %s", out, err, volume) | ||
c.Assert(out, Equals, "N/A", Commentf("volume %s should not belong to any vmgroup", volume)) | ||
} | ||
|
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 clean up the volumes created for the test.
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 volumes are no orphan volumes, and user have no way to access/cleanup those orphan volumes. So we cannot cleanup them through adminCLI or dockerCLI.
As we dicussed in #1469, we should NOT allow user to remove a vmgroup if volumes still in the vmgroup. So testing the scenario that "remove vmgroup without removing volumes" is not needed if we decided to not support remove vmgroup without removing volumes.
I plan to remove this test from the PR.
tests/e2e/vmgroups_test.go
Outdated
c.Assert(err, IsNil, Commentf(out)) | ||
|
||
// Status should be detached | ||
status = verification.VerifyDetachedStatusOnNonDefaultDS(vg.volName2, vg.config.Datastores[1], |
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 function as above can be used for the verification. Verification is best done by exec'ing a container on another docker host VM, which will be successful only when the volume is really detached from the VM.
31c1ae9
to
239e8c0
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.
PR description is missing out following information.
- What fixes this PR is targeting. (title says about the automating test infact there are some refactoring work and improvement to existing code)
Testing Done
section is missing.
|
||
//TODO: Need to implement generic polling logic for better reuse | ||
const maxAttempt = 60 | ||
for attempt := 0; attempt < maxAttempt; attempt++ { | ||
misc.SleepForSec(2) | ||
status := getVolumeStatusHost(name, hostName) | ||
status := getVolumeStatusHost(name+"@"+datastore, hostName) |
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.
can you please shade some information why do we need this change?
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.
Function getVolumeStatusHost
calls dockercli to get the volume status. It actually run docker volume inspect
command, so for volume which is not created on the default_datastore, we need to pass in full name of the volume.
// VerifyDetachedStatus - check if the status gets detached within the timeout | ||
func VerifyDetachedStatus(name, hostName, esxName string) bool { | ||
log.Printf("Confirming detached status for volume [%s]\n", name) | ||
// // VerifyDetachedStatus - check if the status gets detached within the timeout |
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 guess this is dead code and can be cleaned up.
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.
tests/e2e/vmgroups_test.go
Outdated
// need to use full name for volume name | ||
vg.createVolumes(c, vg.volName2+"@"+vg.config.Datastores[1]) | ||
|
||
// Verify volume can be mounted and unmounted for the first volume |
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.
As per the inline comment, please add verification step when volume was attached otherwise inline comment needs to be updated.
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.
Update the comments.
tests/e2e/vmgroups_test.go
Outdated
status := verification.VerifyDetachedStatus(vg.volName1, vg.config.Datastores[0], vg.config.DockerHosts[0], vg.config.EsxHost) | ||
c.Assert(status, Equals, true, Commentf("Volume %s is not detached", vg.volName1)) | ||
|
||
// Verify volume can be mounted and unmounted for the second volume |
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
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.
tests/e2e/vmgroups_test.go
Outdated
// remove VM1 and VM2 from vgTestVMgroup1 and then remove the vmgroup | ||
vmList := []string{vg.config.DockerHostNames[0], vg.config.DockerHostNames[1]} | ||
for _, vm := range vmList { | ||
out, err = adminutils.RemoveVMFromVMgroup(vg.config.EsxHost, vgTestVMgroup1, vm) |
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 one call is sufficient to remove both vms .. admin_cli vmgroup vm remove --name --vm-list
.. am I missing anything here?
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.
// vmgroup has been removed and all volumes belong to it have been removed | ||
// "err.Error()" will be filled with "exit status 1" | ||
volumeList := []string{vg.volName1, vg.volName2} | ||
for _, volume := range volumeList { |
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.
could be replaced with one remote call invocation ..admin_cli volume ls
> verifies volumes created as part of this test method should not be present.
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.
We should use util function instead of call "admin_cli volume ls" directly.
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.
As we discussed, #1496 is filed to track this.
tests/e2e/vmgroups_test.go
Outdated
c.Assert(err.Error(), Equals, "exit status 1", Commentf("volume %s should be removed", volume)) | ||
} | ||
|
||
// Recreate the test VM group1 and add VM1, VM2 back to the vmgroup |
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.
sorry we should avoid this approach .. this leads to confusion any of the step fails (L494-502) instead test should create its own vmgroup and deletes it
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? I checked the existing tests in "vmgroups_test.go", and I followed the approach as other tests. Why it will lead to confusion? Comments already say what is the purpose of the code from L494-502.
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.
As we discussed, #1497 is filed to track this.
9839eb5
to
6feda38
Compare
// VerifyDetachedStatus - check if the status gets detached within the timeout | ||
func VerifyDetachedStatus(name, hostName, esxName string) bool { | ||
log.Printf("Confirming detached status for volume [%s]\n", name) | ||
// VerifyDetachedStatus- check if the status gets detached within the timeout |
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.
minor: golint is complaining about this method document ..
Reference: https://ci.vmware.run/vmware/docker-volume-vsphere/763
../tests/utils/verification/volumeproperties.go:136:1: comment on exported function VerifyDetachedStatus should be of the form "VerifyDetachedStatus ..."
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.
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.
Approving the change as we already have issues raised for some comments here.
tests/e2e/vmgroups_test.go
Outdated
|
||
// Recreate the test VM group1 and add VM1, VM2 back to the vmgroup | ||
// cmd := adminconst.CreateVMgroup + vgTestVMgroup1 + " --default-datastore " + vg.config.Datastores[0] | ||
// log.Printf("Creating test vmgroup %s", vgTestVMgroup1) |
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.
The vmgroup can be created and the two VMs can be added in this command itself via a "--vm-list"
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. Move the restore logic to function RestoreVmgroup
// } | ||
// log.Printf("Timed out to poll status\n") | ||
// return false | ||
// } |
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.
Delete this function instead?
|
||
// remove VM1 and VM2 from vgTestVMgroup1 and then remove the vmgroup | ||
vmList := vg.config.DockerHostNames[0] + "," + vg.config.DockerHostNames[1] | ||
out, err = adminutils.RemoveVMFromVMgroup(vg.config.EsxHost, vgTestVMgroup1, vmList) |
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.
Suggestion, can instead pass the vg.config.DockerHostNames to RemoveVMFromVMgroup() and let it do the creation of the vmlist to pass to the admin cli command. Basically, the test functions are simple and shouldn't have to create special args for the util functions.
tests/e2e/vmgroups_test.go
Outdated
c.Assert(err, IsNil, Commentf(out)) | ||
|
||
out, err = adminutils.AddVMToVMgroup(vg.config.EsxHost, vgTestVMgroup1, vmList) | ||
c.Assert(err, IsNil, Commentf(out)) |
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 is ok, just place it in a separate function RestoreVmgroups() so this test function doesn't look like its cluttered with this restoration code.
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.
tests/e2e/vmgroups_test.go
Outdated
// for _, vm := range vmList { | ||
// out, err = adminutils.AddVMToVMgroup(vg.config.EsxHost, vgTestVMgroup1, vm) | ||
// c.Assert(err, IsNil, Commentf(out)) | ||
// } |
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.
Makes sense to have a separate function to keep this code to restore the configuration.
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. Same as above.
} | ||
if len(volProps) != 2 { | ||
log.Printf("Admin cli output is expected to consist of two elements only - "+ | ||
"volume name and vmgrop. Actual output %s ", op) |
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.
what happens if the same volume name is on two separate datastores, then we will get two lines (I had this scenario and verification/volumeproperties.go:GetVMAttachedToVolUsingAdminCli() failed).
I'll raise an issue for docker volume inspect to return the vmgroup for a volume so we can use it directly.
I've added a function to return a map of volume properties in PR #1500 and that can be modified to return the vmgroup for a volume.
The above approach is prone to errors in different scenarios and have a lot of this code, as much as possible should be using docker to get properties filtered out for our use.
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.
The volume name used in test is unique since it use random generator. So it is not very possible that we hit the scenario that we have same volume name with two different datastores.
For a orphan volume, docker volume inspect
may not able to get the vmgroup associated with the volume.
3854de9
to
0e7d4db
Compare
I think more and decide that we should add function "VerifyDetachedStatusNonDefaultDS" back. We should not try to combine function "VerifyDetachedStatusNonDefaultDS" and "VerifyDetachedStatus" into one. Here are the reasons:
@shuklanirdesh82 @govint |
0b3d0a9
to
022e8c4
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.
overall LGTM!
Please address supplied comments with this review before merging.
func DeleteVMgroup(ip, name string, delete_vol bool) (string, error) { | ||
log.Printf("Deleting a vmgroup [%s] on esx [%s] with delete_vol[%d]\n", name, ip, delete_vol) | ||
if delete_vol { | ||
return ssh.InvokeCommand(ip, admincli.RemoveVMgroup+name+admincli.RemoveVolumes) |
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.
minor: actually command
should have been prepared in if ...else ..
block that improve readability and ssh.InvokeCommand(
would be placed at once out of if
block.
@@ -49,6 +49,9 @@ const ( | |||
// where --name will be name of the vmgroup | |||
ReplaceVMFromVMgroup = vmdkopsAdmin + "vmgroup vm replace --name=" | |||
|
|||
// AddAccessForVMgroup create access perms on vmgroup | |||
AddAccessForVMgroup = vmdkopsAdmin + "vmgroup access add --name " |
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.
L#99 is doing the same thing .. Please remove this one.
//TODO: Need to implement generic polling logic for better reuse | ||
const maxAttempt = 60 | ||
for attempt := 0; attempt < maxAttempt; attempt++ { | ||
misc.SleepForSec(2) |
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 needs to be removed; it may hide if there is any race condition.
022e8c4
to
bd35daf
Compare
@lipingxue, no the VerifyDetachedState() function is sufficient for any scenario - whether default or non-default datastore. The user has the choice to specify the datastore whether its a default or not. The function is only figuring out whether a volume is in detached or attached state. Why should that depend on the datastore? In fact, the restart tests explicitly test for use case where user can attach a volume via short and long name on the default and non-default datastores. |
@govint I don't get your point what do you mean "user has the choice to specify the datastore whether its a default or not". Which parameter that the function need to take so that "user has the choice to specify the datastore whether its a default or not"? The function calls both dockerCLI and adminCLI to figure out the volume is detached or not. For dockerCLI, short name can only be used if the volume is created in the default datastore. Otherwise, user need to specify the full vol name. |
@lipingxue Let's continue the investigation in the next sprint. So not merging this PR. CI is failing: https://ci.vmware.run/vmware/docker-volume-vsphere/842
|
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.
Sorry for the late comments. Change looks good overall.
tests/e2e/swarm_test.go
Outdated
@@ -35,6 +35,7 @@ import ( | |||
|
|||
type SwarmTestSuite struct { | |||
esxName string | |||
dataStores []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.
Leftover during refactoring? Let's remove this unused field.
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.
tests/e2e/vmgroups_test.go
Outdated
@@ -431,3 +432,138 @@ func (vg *VmGroupTest) TestVmGroupVolumeClone(c *C) { | |||
|
|||
misc.LogTestEnd(c.TestName()) | |||
} | |||
|
|||
// Restore VMgroup | |||
func (vg *VmGroupTest) RestoreVmgroup(c *C) { |
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.
Nit: This function should start with small letter since we don't really want to export it.
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.
const maxAttempt = 60 | ||
for attempt := 0; attempt < maxAttempt; attempt++ { | ||
misc.SleepForSec(2) | ||
status := getVolumeStatusHost(name+"@"+datastore, hostName) |
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.
bd35daf
to
545b76c
Compare
@shaominchen I have addressed your comments, please take a look. Thanks! |
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.
First commit. First checkpoint. Second checkpoint. Third checkpoint. Checkpoint 4. Revert change in Makefile
760c2bc
to
40eaf58
Compare
Fixed #1341
This PR includes
VerifyDetachedStatus
to meet the need for automating this testTest Done:
Only swarm related tests failed since I do not have a swarm setup