mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-26 20:13:29 +00:00
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:
parent
813671d1a0
commit
70e0f8197a
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user