Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
Signed-off-by: terasihma <[email protected]>
  • Loading branch information
terassyi committed Jan 11, 2024
1 parent 7a7eb1b commit 4b2705a
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 162 deletions.
4 changes: 2 additions & 2 deletions v2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PROTOC_OUTPUTS = pkg/cnirpc/cni.pb.go pkg/cnirpc/cni_grpc.pb.go ../docs/cni-grpc
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
PROTOC := PATH=$(PWD)/bin:'$(PATH)' $(PWD)/bin/protoc -I=$(PWD)/include:.
PODNSLIST = pod1 pod2 pod3
PODNSLIST = pod1 pod2 pod3 pod4 pod5 pod6
NATNSLIST = nat-client nat-router nat-egress nat-target
OTHERNSLIST = test-egress-dual test-egress-v4 test-egress-v6 \
test-client-dual test-client-v4 test-client-v6 test-client-custom \
Expand Down Expand Up @@ -51,7 +51,7 @@ test-nodenet:
for i in $@ $(PODNSLIST); do $(SUDO) ip netns add $$i; done
for i in $@ $(PODNSLIST); do $(SUDO) ip netns exec $$i ip link set lo up; done
$(SUDO) ip netns exec $@ ./nodenet.test -test.v
for i in $@ $(PODNSLIST); do $(SUDO) ip netns delete $$i; done
# for i in $@ $(PODNSLIST); do $(SUDO) ip netns delete $$i; done
rm -f nodenet.test

.PHONY: test-founat
Expand Down
1 change: 1 addition & 0 deletions v2/e2e/manifests/nat-client-sport-auto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spec:
operator: Exists
nodeSelector:
test: coil
kubernetes.io/hostname: coil-worker2
containers:
- name: ubuntu
image: quay.io/cybozu/ubuntu-debug:22.04
Expand Down
2 changes: 1 addition & 1 deletion v2/pkg/nodenet/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func (pn *podNetwork) Update(podIPv4, podIPv6 net.IP, hook SetupHook) error {
var netNsPath string
for _, c := range podConfigs {
// When both c.IPvX and podIPvX are nil, net.IP.Equal() returns always true.
// Avoiding comparing nil to nil, confirm c.IPvX is not nil.
// To avoid comparing nil to nil, confirm c.IPvX is not nil.
if (c.IPv4 != nil && c.IPv4.Equal(podIPv4)) || (c.IPv6 != nil && c.IPv6.Equal(podIPv6)) {
netNsPath, err = getNetNsPath(c.HostVethName)
if err != nil {
Expand Down
Loading

0 comments on commit 4b2705a

Please sign in to comment.