Correct errors in the netpol test suite

It was confusing to see message saying "unable to update pod" when it
was actually trying to create a Pod.

Signed-off-by: Quan Tian <qtian@vmware.com>
This commit is contained in:
Quan Tian 2022-05-12 10:48:51 +08:00
parent cae22d8b8a
commit b792f7392f

View File

@ -179,7 +179,7 @@ func (k *kubeManager) createNamespace(ns *v1.Namespace) (*v1.Namespace, error) {
enforcePodSecurityBaseline(ns) enforcePodSecurityBaseline(ns)
createdNamespace, err := k.clientSet.CoreV1().Namespaces().Create(context.TODO(), ns, metav1.CreateOptions{}) createdNamespace, err := k.clientSet.CoreV1().Namespaces().Create(context.TODO(), ns, metav1.CreateOptions{})
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to update namespace %s: %w", ns.Name, err) return nil, fmt.Errorf("unable to create namespace %s: %w", ns.Name, err)
} }
return createdNamespace, nil return createdNamespace, nil
} }
@ -203,7 +203,7 @@ func (k *kubeManager) createPod(pod *v1.Pod) (*v1.Pod, error) {
createdPod, err := k.clientSet.CoreV1().Pods(ns).Create(context.TODO(), pod, metav1.CreateOptions{}) createdPod, err := k.clientSet.CoreV1().Pods(ns).Create(context.TODO(), pod, metav1.CreateOptions{})
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to update pod %s/%s: %w", ns, pod.Name, err) return nil, fmt.Errorf("unable to create pod %s/%s: %w", ns, pod.Name, err)
} }
return createdPod, nil return createdPod, nil
} }