Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some ut #1130

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading