Skip to content

Commit

Permalink
golint fix
Browse files Browse the repository at this point in the history
Signed-off-by: LiZhenCheng9527 <[email protected]>
  • Loading branch information
LiZhenCheng9527 committed Jul 29, 2024
1 parent dcc3c1d commit 5bc1de2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/auth/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ func isEmptyMatch(m *security.Match) bool {
// todo : get identity form tls connection
func (r *Rbac) getIdentityByIp(ip []byte) Identity {
var networkAddress cache.NetworkAddress
networkAddress.Address, _ = netip.AddrFromSlice(restoreIPv4(ip))
networkAddress.Address, _ = netip.AddrFromSlice(ip)
workload := r.workloadCache.GetWorkloadByAddr(networkAddress)
if workload == nil {
log.Warnf("get workload from ip %v FAILED", ip)
Expand Down
7 changes: 4 additions & 3 deletions pkg/controller/telemetry/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
"github.com/stretchr/testify/assert"

"kmesh.net/kmesh/api/v2/workloadapi"
"kmesh.net/kmesh/pkg/controller/workload/cache"
)
Expand Down Expand Up @@ -253,7 +254,7 @@ func TestBuildMetricsToPrometheus(t *testing.T) {
}
}

func TestbuildWorkloadMetric(t *testing.T) {
func TestBuildWorkloadMetric(t *testing.T) {
type args struct {
dstWorkload *workloadapi.Workload
srcWorkload *workloadapi.Workload
Expand Down Expand Up @@ -318,7 +319,7 @@ func TestbuildWorkloadMetric(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
actualLabels := buildWorkloadMetric(tt.args.dstWorkload, tt.args.srcWorkload)
expectMap := struct2map(tt.want)
actualMap := struct2map(&actualLabels)
actualMap := struct2map(actualLabels)
assert.Equal(t, expectMap, actualMap)
})
}
Expand Down Expand Up @@ -501,7 +502,7 @@ func TestBuildServiceMetric(t *testing.T) {
{192, 168, 224, 22},
},
Services: map[string]*workloadapi.PortList{
"kmesh-system/kmesh.kmesh-system.svc.cluster.local": &workloadapi.PortList{
"kmesh-system/kmesh.kmesh-system.svc.cluster.local": {
Ports: []*workloadapi.Port{
{
TargetPort: 80,
Expand Down

0 comments on commit 5bc1de2

Please sign in to comment.