You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit uses the eventmetric package to fallback to metric
assertions whenever PTP events are not enabled.
Additionally, it flips the semantics of CurrentState. By default, the
CurrentState logs are excluded since they don't represent events being
sent to the consumer. They may be explicitly enabled when desired.
There are a few complexities still, such as some assertions needing to
be events-only due to the metric being too transient to capture.
Additionally, the tests will now configure the ServiceMonitor such that
Prometheus scrapes the metrics every second instead of the default 30
seconds. This improves the precision of metric assertions.
Assisted-by: Cursor
Copy file name to clipboardExpand all lines: tests/cnf/ran/ptp/internal/events/README.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,9 @@ The `WaitForEvent` function accepts several optional parameters:
33
33
34
34
Specifies the container name within the pod from which to retrieve logs. If not specified, logs are retrieved from the default container. This is particularly useful when monitoring PTP events from specific containers like `"cloud-event-proxy"`.
Controls whether to ignore messages about the current state of events. When set to `true`, only events received as subscriptions are considered, filtering out initial state reports. This is useful when you want to wait for new events rather than existing state information.
38
+
Controls whether to include messages about the current state of events. By default, current state messages are not included.
39
39
40
40
### Event Filtering
41
41
@@ -112,14 +112,13 @@ func main() {
112
112
113
113
fmt.Printf("Waiting for PTP Sync State Locked event on interface %s...\n", targetInterface)
114
114
115
-
// Use both WithContainer and WithoutCurrentState options
115
+
// Use the container option.
116
116
err:= events.WaitForEvent(
117
117
myPtpPod,
118
118
startTime,
119
119
timeout,
120
120
eventFilter,
121
121
events.WithContainer("cloud-event-proxy"),
122
-
events.WithoutCurrentState(true), // Only wait for new events, not current state
0 commit comments