diff --git a/bpf/include/bpf_common.h b/bpf/include/bpf_common.h index 233d62850..939bc43ad 100644 --- a/bpf/include/bpf_common.h +++ b/bpf/include/bpf_common.h @@ -174,7 +174,6 @@ static inline void *kmesh_get_ptr_val(const void *ptr) __u32 inner_idx = 0; __u64 idx = (__u64)ptr; - BPF_LOG(DEBUG, KMESH, "kmesh_get_ptr_val idx=%u\n", idx); if (!ptr) { return NULL; } diff --git a/pkg/auth/policy_store.go b/pkg/auth/policy_store.go index d56f65f45..84f5dd80c 100644 --- a/pkg/auth/policy_store.go +++ b/pkg/auth/policy_store.go @@ -43,7 +43,8 @@ func newPolicyStore() *policyStore { } } -func flushAuthzMap(policyName string, authzPolicy *security.Authorization) error { +//go:noinline +func FlushAuthzMap(policyName string, authzPolicy *security.Authorization) error { return maps_v2.AuthorizationUpdate(policyName, authzPolicy) } @@ -52,7 +53,7 @@ func (ps *policyStore) updatePolicy(authPolicy *security.Authorization) error { return nil } key := authPolicy.ResourceName() - if err := flushAuthzMap(key, authPolicy); err != nil { + if err := FlushAuthzMap(key, authPolicy); err != nil { return fmt.Errorf("flushAuthzMap failed %v ", err) } diff --git a/pkg/controller/workload/workload_controller_test.go b/pkg/controller/workload/workload_controller_test.go index b9aab7e3d..4104952de 100644 --- a/pkg/controller/workload/workload_controller_test.go +++ b/pkg/controller/workload/workload_controller_test.go @@ -54,6 +54,7 @@ func TestWorkloadStreamCreateAndSend(t *testing.T) { Stream: fakeClient.DeltaClient, } + patches0 := gomonkey.NewPatches() patches1 := gomonkey.NewPatches() patches2 := gomonkey.NewPatches() tests := []struct { @@ -148,8 +149,8 @@ func TestWorkloadStreamCreateAndSend(t *testing.T) { { name: "should take initial authorization versions", beforeFunc: func(t *testing.T) { + patches0.ApplyFuncReturn(auth.FlushAuthzMap, nil) patches1.ApplyMethodReturn(fakeClient.Client, "DeltaAggregatedResources", fakeClient.DeltaClient, nil) - workloadController.Processor = newProcessor(workloadMap) workloadController.Rbac = auth.NewRbac(nil) workloadController.Rbac.UpdatePolicy(&security.Authorization{