Skip to content

Commit

Permalink
remove unit test for previously removed consul-cni validation
Browse files Browse the repository at this point in the history
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: #1527
Ref: hashicorp/nomad#10628
  • Loading branch information
tgross committed Mar 20, 2024
1 parent 838ba6a commit 2deab08
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions control-plane/cni/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 2deab08

Please sign in to comment.