@@ -44,18 +44,19 @@ type check struct {
4444 cmd []string
4545}
4646
47- func CreateValidator (ctx context.Context , clienset * kubernetes.Clientset , config * rest.Config , namespace , cni string , restartCase bool , os string ) (* Validator , error ) {
47+ func CreateValidator (ctx context.Context , clientset * kubernetes.Clientset , config * rest.Config , namespace , cni string , restartCase bool , os string ) (* Validator , error ) {
4848 // deploy privileged pod
4949 privilegedDaemonSet , err := k8sutils .MustParseDaemonSet (privilegedDaemonSetPathMap [os ])
5050 if err != nil {
5151 return nil , errors .Wrap (err , "unable to parse daemonset" )
5252 }
53- daemonsetClient := clienset .AppsV1 ().DaemonSets (privilegedNamespace )
53+ daemonsetClient := clientset .AppsV1 ().DaemonSets (privilegedNamespace )
5454 if err := k8sutils .MustCreateDaemonset (ctx , daemonsetClient , privilegedDaemonSet ); err != nil {
5555 return nil , errors .Wrap (err , "unable to create daemonset" )
5656 }
57- if err := k8sutils .WaitForPodsRunning (ctx , clienset , privilegedNamespace , privilegedLabelSelector ); err != nil {
58- return nil , errors .Wrap (err , "error while waiting for pods to be running" )
57+ // Ensures that pods have been replaced if test is re-run after failure
58+ if err := k8sutils .WaitForPodDaemonset (ctx , clientset , privilegedNamespace , privilegedDaemonSet .Name , privilegedLabelSelector ); err != nil {
59+ return nil , errors .Wrap (err , "unable to wait for daemonset" )
5960 }
6061
6162 var checks []check
@@ -69,7 +70,7 @@ func CreateValidator(ctx context.Context, clienset *kubernetes.Clientset, config
6970 }
7071
7172 return & Validator {
72- clientset : clienset ,
73+ clientset : clientset ,
7374 config : config ,
7475 namespace : namespace ,
7576 cni : cni ,
@@ -124,7 +125,7 @@ func (v *Validator) ValidateRestartNetwork(ctx context.Context) error {
124125 // exec into the pod to get the state file
125126 _ , err = k8sutils .ExecCmdOnPod (ctx , v .clientset , privilegedNamespace , privelegedPod .Name , restartNetworkCmd , v .config )
126127 if err != nil {
127- return errors .Wrapf (err , "failed to exec into privileged pod" )
128+ return errors .Wrapf (err , "failed to exec into privileged pod - %s" , privelegedPod . Name )
128129 }
129130 err = k8sutils .WaitForPodsRunning (ctx , v .clientset , "" , "" )
130131 if err != nil {
@@ -151,7 +152,7 @@ func (v *Validator) validateIPs(ctx context.Context, stateFileIps stateFileIpsFu
151152 // exec into the pod to get the state file
152153 result , err := k8sutils .ExecCmdOnPod (ctx , v .clientset , namespace , podName , cmd , v .config )
153154 if err != nil {
154- return errors .Wrapf (err , "failed to exec into privileged pod" )
155+ return errors .Wrapf (err , "failed to exec into privileged pod - %s" , podName )
155156 }
156157 filePodIps , err := stateFileIps (result )
157158 if err != nil {
0 commit comments