The Contiv system tests in netplugin/test/systemtests call time.Sleep() 151 times in code, many of them in loops. Due to this, the time needed to run these system tests is high. Netplugin CI needs 2.5 hours to run them.
This PR optimizes and reduces the sleeps in system tests' code in the following areas:
Add polling code in contivModelClient.go to poll for the status of the objects AppProfile, EndpointGroup, Global, Network, Rule after creating (httpPost) and deleting (httpDelete) them.
Remove sleep in the tests and poll for the status of objects AppProfile, EndpointGroup, Global, Network, Rule after creating and deleting them.
Add execRetry to retry a command if it fails for a specific duration.
Call execRetry instead of execBG in startListener and checkConnection so that they will be retried if they fail in the tests.
Replace RunCommandBackground with RunCommand so that the test blocks until the command completes.
Replace podExecBG with podExec so that the test blocks until the kubectl exec command completes.
Remove unwanted sleep in code.
Reduce sleep in code wherever needed.
Optimize polling interval in code when checking things like:
Node is reloaded
Etcd and consul are restarted
Interface is flapped
VTEPs are verified
ACI gateway is restarted
Checking for the status of Netplugin after starting and stopping it
The Contiv system tests in
netplugin/test/systemtests
calltime.Sleep()
151 times in code, many of them in loops. Due to this, the time needed to run these system tests is high. Netplugin CI needs 2.5 hours to run them.This PR optimizes and reduces the sleeps in system tests' code in the following areas:
contivModelClient.go
to poll for the status of the objectsAppProfile
,EndpointGroup
,Global
,Network
,Rule
after creating (httpPost
) and deleting (httpDelete
) them.AppProfile
,EndpointGroup
,Global
,Network
,Rule
after creating and deleting them.execRetry
to retry a command if it fails for a specific duration.execRetry
instead ofexecBG
instartListener
andcheckConnection
so that they will be retried if they fail in the tests.RunCommandBackground
withRunCommand
so that the test blocks until the command completes.podExecBG
withpodExec
so that the test blocks until thekubectl exec
command completes.Signed-off-by: Vikram Hosakote vhosakot@cisco.com