Skip to content

Commit fccc13b

Browse files
committed
Add some ut
Signed-off-by: bzsuni <[email protected]>
1 parent 1e4de21 commit fccc13b

File tree

6 files changed

+832
-4
lines changed

6 files changed

+832
-4
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ unitest_tests:
362362
-@rm -rf $(UNITEST_OUTPUT)
363363
-@mkdir -p $(UNITEST_OUTPUT)
364364
@echo "run unitest tests"
365-
sudo $(ROOT_DIR)/tools/golang/ginkgo.sh \
365+
sudo $(ROOT_DIR)/tools/golang/ginkgo.sh -gcflags "-l" \
366366
--cover --coverprofile=./coverage.out --covermode set \
367367
--json-report unitestreport.json \
368368
-randomize-suites -randomize-all --keep-going --timeout=1h -p --slow-spec-threshold=120s \

pkg/agent/metrics/metrics_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2022 Authors of spidernet-io
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package metrics
5+
6+
import (
7+
"testing"
8+
)
9+
10+
func TestRegisterMetricCollectors(t *testing.T) {
11+
RegisterMetricCollectors()
12+
}

pkg/agent/route/route.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,18 @@ func (r *RuleRoute) Ensure(linkName string, ipv4, ipv6 *net.IP, table int, mark
8888

8989
log.V(1).Info("get link")
9090

91-
err = r.ensureRoute(link, ipv4, netlink.FAMILY_V4, table, log)
91+
err = r.EnsureRoute(link, ipv4, netlink.FAMILY_V4, table, log)
9292
if err != nil {
9393
return err
9494
}
95-
err = r.ensureRoute(link, ipv6, netlink.FAMILY_V6, table, log)
95+
err = r.EnsureRoute(link, ipv6, netlink.FAMILY_V6, table, log)
9696
if err != nil {
9797
return err
9898
}
9999
return nil
100100
}
101101

102-
func (r *RuleRoute) ensureRoute(link netlink.Link, ip *net.IP, family int, table int, log logr.Logger) error {
102+
func (r *RuleRoute) EnsureRoute(link netlink.Link, ip *net.IP, family int, table int, log logr.Logger) error {
103103
log = log.WithValues("family", family, "ip", ip)
104104
log.V(1).Info("ensure route")
105105

0 commit comments

Comments
 (0)