Skip to content

Commit

Permalink
Merge pull request #1130 from spidernet-io/bz/ut/agent
Browse files Browse the repository at this point in the history
Add some ut
  • Loading branch information
bzsuni authored Jan 24, 2024
2 parents f90e9a9 + 885b879 commit b826d98
Show file tree
Hide file tree
Showing 12 changed files with 5,886 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ unitest_tests:
-@rm -rf $(UNITEST_OUTPUT)
-@mkdir -p $(UNITEST_OUTPUT)
@echo "run unitest tests"
sudo $(ROOT_DIR)/tools/golang/ginkgo.sh \
sudo $(ROOT_DIR)/tools/golang/ginkgo.sh -gcflags "-l" \
--cover --coverprofile=./coverage.out --covermode set \
--json-report unitestreport.json \
-randomize-suites -randomize-all --keep-going --timeout=1h -p --slow-spec-threshold=120s \
Expand Down
12 changes: 12 additions & 0 deletions pkg/agent/metrics/metrics_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2022 Authors of spidernet-io
// SPDX-License-Identifier: Apache-2.0

package metrics

import (
"testing"
)

func TestRegisterMetricCollectors(t *testing.T) {
RegisterMetricCollectors()
}
6 changes: 3 additions & 3 deletions pkg/agent/route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ func (r *RuleRoute) Ensure(linkName string, ipv4, ipv6 *net.IP, table int, mark

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

err = r.ensureRoute(link, ipv4, netlink.FAMILY_V4, table, log)
err = r.EnsureRoute(link, ipv4, netlink.FAMILY_V4, table, log)
if err != nil {
return err
}
err = r.ensureRoute(link, ipv6, netlink.FAMILY_V6, table, log)
err = r.EnsureRoute(link, ipv6, netlink.FAMILY_V6, table, log)
if err != nil {
return err
}
return nil
}

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

Expand Down
Loading

0 comments on commit b826d98

Please sign in to comment.