Fix the leak of vSphere client sessions
Implement the test cleanup callback method to close any open vSphere client connections. Without this clean up sessions were leaking during testing.
This commit is contained in:
@@ -1491,10 +1491,19 @@ func (v *vSphereDriver) GetDynamicProvisionStorageClass(config *storageframework
|
||||
|
||||
func (v *vSphereDriver) PrepareTest(f *framework.Framework) (*storageframework.PerTestConfig, func()) {
|
||||
return &storageframework.PerTestConfig{
|
||||
Driver: v,
|
||||
Prefix: "vsphere",
|
||||
Framework: f,
|
||||
}, func() {}
|
||||
Driver: v,
|
||||
Prefix: "vsphere",
|
||||
Framework: f,
|
||||
}, func() {
|
||||
// Driver Cleanup function
|
||||
// Logout each vSphere client connection to prevent session leakage
|
||||
nodes := vspheretest.GetReadySchedulableNodeInfos()
|
||||
for _, node := range nodes {
|
||||
if node.VSphere.Client != nil {
|
||||
node.VSphere.Client.Logout(context.TODO())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (v *vSphereDriver) CreateVolume(config *storageframework.PerTestConfig, volType storageframework.TestVolType) storageframework.TestVolume {
|
||||
|
||||
Reference in New Issue
Block a user