Fix portmap unit tests
Use `conditionsV4` and `conditionsV6` values that actually look like valid iptables conditions. Signed-off-by: Dan Winship <danwinship@redhat.com>
This commit is contained in:
parent
a3ccebc6ec
commit
3d1968c152
@ -42,8 +42,8 @@ var _ = Describe("portmapping configuration", func() {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"snat": false,
|
"snat": false,
|
||||||
"conditionsV4": ["a", "b"],
|
"conditionsV4": ["-s", "1.2.3.4"],
|
||||||
"conditionsV6": ["c", "d"],
|
"conditionsV6": ["-s", "12::34"],
|
||||||
"prevResult": {
|
"prevResult": {
|
||||||
"interfaces": [
|
"interfaces": [
|
||||||
{"name": "host"},
|
{"name": "host"},
|
||||||
@ -74,8 +74,8 @@ var _ = Describe("portmapping configuration", func() {
|
|||||||
c, _, err := parseConfig(configBytes, "container")
|
c, _, err := parseConfig(configBytes, "container")
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(c.CNIVersion).To(Equal(ver))
|
Expect(c.CNIVersion).To(Equal(ver))
|
||||||
Expect(c.ConditionsV4).To(Equal(&[]string{"a", "b"}))
|
Expect(c.ConditionsV4).To(Equal(&[]string{"-s", "1.2.3.4"}))
|
||||||
Expect(c.ConditionsV6).To(Equal(&[]string{"c", "d"}))
|
Expect(c.ConditionsV6).To(Equal(&[]string{"-s", "12::34"}))
|
||||||
fvar := false
|
fvar := false
|
||||||
Expect(c.SNAT).To(Equal(&fvar))
|
Expect(c.SNAT).To(Equal(&fvar))
|
||||||
Expect(c.Name).To(Equal("test"))
|
Expect(c.Name).To(Equal("test"))
|
||||||
@ -95,14 +95,14 @@ var _ = Describe("portmapping configuration", func() {
|
|||||||
"type": "portmap",
|
"type": "portmap",
|
||||||
"cniVersion": "%s",
|
"cniVersion": "%s",
|
||||||
"snat": false,
|
"snat": false,
|
||||||
"conditionsV4": ["a", "b"],
|
"conditionsV4": ["-s", "1.2.3.4"],
|
||||||
"conditionsV6": ["c", "d"]
|
"conditionsV6": ["-s", "12::34"]
|
||||||
}`, ver))
|
}`, ver))
|
||||||
c, _, err := parseConfig(configBytes, "container")
|
c, _, err := parseConfig(configBytes, "container")
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(c.CNIVersion).To(Equal(ver))
|
Expect(c.CNIVersion).To(Equal(ver))
|
||||||
Expect(c.ConditionsV4).To(Equal(&[]string{"a", "b"}))
|
Expect(c.ConditionsV4).To(Equal(&[]string{"-s", "1.2.3.4"}))
|
||||||
Expect(c.ConditionsV6).To(Equal(&[]string{"c", "d"}))
|
Expect(c.ConditionsV6).To(Equal(&[]string{"-s", "12::34"}))
|
||||||
fvar := false
|
fvar := false
|
||||||
Expect(c.SNAT).To(Equal(&fvar))
|
Expect(c.SNAT).To(Equal(&fvar))
|
||||||
Expect(c.Name).To(Equal("test"))
|
Expect(c.Name).To(Equal("test"))
|
||||||
@ -114,8 +114,8 @@ var _ = Describe("portmapping configuration", func() {
|
|||||||
"type": "portmap",
|
"type": "portmap",
|
||||||
"cniVersion": "%s",
|
"cniVersion": "%s",
|
||||||
"snat": false,
|
"snat": false,
|
||||||
"conditionsV4": ["a", "b"],
|
"conditionsV4": ["-s", "1.2.3.4"],
|
||||||
"conditionsV6": ["c", "d"],
|
"conditionsV6": ["-s", "12::34"],
|
||||||
"runtimeConfig": {
|
"runtimeConfig": {
|
||||||
"portMappings": [
|
"portMappings": [
|
||||||
{ "hostPort": 0, "containerPort": 80, "protocol": "tcp"}
|
{ "hostPort": 0, "containerPort": 80, "protocol": "tcp"}
|
||||||
@ -136,7 +136,7 @@ var _ = Describe("portmapping configuration", func() {
|
|||||||
{ "hostPort": 8080, "containerPort": 80, "protocol": "tcp"}
|
{ "hostPort": 8080, "containerPort": 80, "protocol": "tcp"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"conditionsV4": ["a", "b"],
|
"conditionsV4": ["-s", "1.2.3.4"],
|
||||||
"prevResult": {
|
"prevResult": {
|
||||||
"interfaces": [
|
"interfaces": [
|
||||||
{"name": "host"}
|
{"name": "host"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user