Skip to content

Commit

Permalink
in_kubernetes_events: add tests for timestamp logic
Browse files Browse the repository at this point in the history
Signed-off-by: ryanohnemus <[email protected]>
  • Loading branch information
ryanohnemus committed Jan 3, 2024
1 parent b9e0193 commit 377bf12
Show file tree
Hide file tree
Showing 7 changed files with 463 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ if(FLB_OUT_LIB)
FLB_RT_TEST(FLB_IN_TCP "in_tcp.c")
FLB_RT_TEST(FLB_IN_FORWARD "in_forward.c")
FLB_RT_TEST(FLB_IN_FLUENTBIT_METRICS "in_fluentbit_metrics.c")
FLB_RT_TEST(FLB_IN_KUBERNETES_EVENTS "in_kubernetes_events.c")
endif()

# Filter Plugins
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"kind": "EventList",
"apiVersion": "v1",
"metadata": {
"resourceVersion": "177157"
},
"items": [
{
"metadata": {
"name": "fluent-bit-78945dccd8-2g7qg.17a3c80ba0453aee",
"namespace": "default",
"uid": "6e3013d5-a79b-4dc4-b6c0-6b652302672e",
"resourceVersion": "176761",
"creationTimestamp": "2023-12-24T13:37:16Z",
"managedFields": [
{
"manager": "kube-scheduler",
"operation": "Update",
"apiVersion": "events.k8s.io/v1",
"time": "2023-12-24T13:37:16Z",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:action": {},
"f:eventTime": {},
"f:note": {},
"f:reason": {},
"f:regarding": {},
"f:reportingController": {},
"f:reportingInstance": {},
"f:type": {}
}
}
]
},
"involvedObject": {
"kind": "Pod",
"namespace": "default",
"name": "fluent-bit-78945dccd8-2g7qg",
"uid": "ed7de8ff-61fb-40bb-9ecb-55a801a4cd89",
"apiVersion": "v1",
"resourceVersion": "176749"
},
"reason": "FailedScheduling",
"message": "0/1 nodes are available: 1 Insufficient cpu. preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod..",
"source": {},
"firstTimestamp": null,
"lastTimestamp": null,
"type": "Warning",
"eventTime": "2023-12-24T13:37:16.335172Z",
"action": "Scheduling",
"reportingComponent": "default-scheduler",
"reportingInstance": "default-scheduler-minikube"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1703425036.000000,{"metadata":{"name":"fluent-bit-78945dccd8-2g7qg.17a3c80ba0453aee","namespace":"default","uid":"6e3013d5-a79b-4dc4-b6c0-6b652302672e","resourceVersion":"176761","creationTimestamp":"2023-12-24T13:37:16Z","managedFields":[{"manager":"kube-scheduler","operation":"Update","apiVersion":"events.k8s.io/v1","time":"2023-12-24T13:37:16Z","fieldsType":"FieldsV1","fieldsV1":{"f:action":{},"f:eventTime":{},"f:note":{},"f:reason":{},"f:regarding":{},"f:reportingController":{},"f:reportingInstance":{},"f:type":{}}}]},"involvedObject":{"kind":"Pod","namespace":"default","name":"fluent-bit-78945dccd8-2g7qg","uid":"ed7de8ff-61fb-40bb-9ecb-55a801a4cd89","apiVersion":"v1","resourceVersion":"176749"},"reason":"FailedScheduling","message":"0/1 nodes are available: 1 Insufficient cpu. preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod..","source":{},"firstTimestamp":null,"lastTimestamp":null,"type":"Warning","eventTime":"2023-12-24T13:37:16.335172Z","action":"Scheduling","reportingComponent":"default-scheduler","reportingInstance":"default-scheduler-minikube"}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"kind": "EventList",
"apiVersion": "v1",
"metadata": {
"resourceVersion": "177157"
},
"items": [
{
"metadata": {
"name": ".17a3ba8b4aa36c81",
"namespace": "default",
"uid": "ec5546b7-f1b9-4e61-a90c-a1f3b611edbc",
"resourceVersion": "174688",
"creationTimestamp": "2023-12-24T09:30:07Z",
"managedFields": [
{
"manager": "storage-provisioner",
"operation": "Update",
"apiVersion": "v1",
"time": "2023-12-24T09:30:07Z",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:count": {},
"f:firstTimestamp": {},
"f:involvedObject": {},
"f:lastTimestamp": {},
"f:message": {},
"f:reason": {},
"f:source": {
"f:component": {}
},
"f:type": {}
}
}
]
},
"involvedObject": {
"kind": "Endpoints",
"apiVersion": "v1"
},
"reason": "LeaderElection",
"message": "minikube_31f5cdfb-29b0-4f84-9f9c-585088e9235f stopped leading",
"source": {
"component": "k8s.io/minikube-hostpath_minikube_31f5cdfb-29b0-4f84-9f9c-585088e9235f"
},
"firstTimestamp": "2023-12-24T09:29:51Z",
"lastTimestamp": "2023-12-24T09:29:51Z",
"count": 1,
"type": "Normal",
"eventTime": null,
"reportingComponent": "",
"reportingInstance": ""
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1703410191.000000,{"metadata":{"name":".17a3ba8b4aa36c81","namespace":"default","uid":"ec5546b7-f1b9-4e61-a90c-a1f3b611edbc","resourceVersion":"174688","creationTimestamp":"2023-12-24T09:30:07Z","managedFields":[{"manager":"storage-provisioner","operation":"Update","apiVersion":"v1","time":"2023-12-24T09:30:07Z","fieldsType":"FieldsV1","fieldsV1":{"f:count":{},"f:firstTimestamp":{},"f:involvedObject":{},"f:lastTimestamp":{},"f:message":{},"f:reason":{},"f:source":{"f:component":{}},"f:type":{}}}]},"involvedObject":{"kind":"Endpoints","apiVersion":"v1"},"reason":"LeaderElection","message":"minikube_31f5cdfb-29b0-4f84-9f9c-585088e9235f stopped leading","source":{"component":"k8s.io/minikube-hostpath_minikube_31f5cdfb-29b0-4f84-9f9c-585088e9235f"},"firstTimestamp":"2023-12-24T09:29:51Z","lastTimestamp":"2023-12-24T09:29:51Z","count":1,"type":"Normal","eventTime":null,"reportingComponent":"","reportingInstance":""}]
1 change: 1 addition & 0 deletions tests/runtime/data/in_kubernetes_events/token
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fakeTokenFile
Loading

0 comments on commit 377bf12

Please sign in to comment.