Skip to content

Commit

Permalink
e2e: check policy state
Browse files Browse the repository at this point in the history
When we check whether a policy is there, having it appear in the list is
not enough. We need to check that its state is enabled and that there
are no errors.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
  • Loading branch information
kkourt committed Mar 21, 2024
1 parent 10188c6 commit ef9787d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/e2e/helpers/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/cilium/tetragon/api/v1/tetragon"
"github.com/cilium/tetragon/tests/e2e/state"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
Expand Down Expand Up @@ -65,7 +66,14 @@ func ensureTracingPolicy(ctx context.Context, policyName string, client tetragon

for _, pol := range res.GetPolicies() {
if pol.GetName() == policyName {
return nil
if pol.State == tetragon.TracingPolicyState_TP_STATE_ENABLED && pol.Error == "" {
return nil
}
return fmt.Errorf("policy %s exists but is in state:%s (error:%s)",
policyName,
tetragon.TracingPolicyState_name[int32(pol.State)],
pol.Error,
)
}
}

Expand Down

0 comments on commit ef9787d

Please sign in to comment.