From 0517eee94f9898764a85e0d19d60dab5f54051d7 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Fri, 15 Mar 2024 15:00:31 -0400 Subject: [PATCH] remove unit test for previously removed `consul-cni` validation In #1527, we added support for OpenShift and Multus, which meant that the `consul-cni` plugin was no longer necessarily the final CNI plugin run. While working on a patch to allow compatibility with Nomad transparent proxy, I discovered we'd never removed a now-failing unit test of the plugin for the validation step. It looks like the remaining unit tests still cover the remaining validation, so we can safely remove this test. Ref: https://github.com/hashicorp/consul-k8s/pull/1527 Ref: https://github.com/hashicorp/nomad/issues/10628 --- control-plane/cni/main_test.go | 41 ---------------------------------- 1 file changed, 41 deletions(-) diff --git a/control-plane/cni/main_test.go b/control-plane/cni/main_test.go index dc929f1408..9af2e274b0 100644 --- a/control-plane/cni/main_test.go +++ b/control-plane/cni/main_test.go @@ -66,22 +66,6 @@ func Test_cmdAdd(t *testing.T) { expectedErr: fmt.Errorf("not running in a pod, namespace and pod should have values"), expectedRules: false, // Rules won't be applied because the command will throw an error first }, - { - name: "Missing prevResult in stdin data, should throw error", - cmd: &Command{ - client: fake.NewSimpleClientset(), - }, - podName: "missing-prev-result", - stdInData: missingPrevResultStdinData, - configuredPod: func(pod *corev1.Pod, cmd *Command) *corev1.Pod { - _, err := cmd.client.CoreV1().Pods(defaultNamespace).Create(context.Background(), pod, metav1.CreateOptions{}) - require.NoError(t, err) - - return pod - }, - expectedErr: fmt.Errorf("must be called as final chained plugin"), - expectedRules: false, // Rules won't be applied because the command will throw an error first - }, { name: "Missing IPs in prevResult in stdin data, should throw error", cmd: &Command{ @@ -336,31 +320,6 @@ const goodStdinData = `{ "type": "consul-cni" }` -const missingPrevResultStdinData = `{ - "cniVersion": "0.3.1", - "name": "kindnet", - "type": "kindnet", - "capabilities": { - "testCapability": false - }, - "ipam": { - "type": "host-local" - }, - "dns": { - "nameservers": ["nameserver"], - "domain": "domain", - "search": ["search"], - "options": ["option"] - }, - "cni_bin_dir": "/opt/cni/bin", - "cni_net_dir": "/etc/cni/net.d", - "kubeconfig": "ZZZ-consul-cni-kubeconfig", - "log_level": "info", - "multus": false, - "name": "consul-cni", - "type": "consul-cni" -}` - const missingIPsStdinData = `{ "cniVersion": "0.3.1", "name": "kindnet",