Skip to content

Commit

Permalink
Add nodeName to test data
Browse files Browse the repository at this point in the history
Verify its set as a label in tests
  • Loading branch information
george-angel committed Nov 15, 2024
1 parent da0f0a6 commit dd14294
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
36 changes: 18 additions & 18 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,58 +14,58 @@ import (
func Test_collectSummaryMetrics(t *testing.T) {
expectedOut := `# HELP kube_summary_container_logs_available_bytes Number of bytes that aren't consumed by the container logs
# TYPE kube_summary_container_logs_available_bytes gauge
kube_summary_container_logs_available_bytes{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 9.0016837632e+10
kube_summary_container_logs_available_bytes{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 9.0016837632e+10
# HELP kube_summary_container_logs_capacity_bytes Number of bytes that can be consumed by the container logs
# TYPE kube_summary_container_logs_capacity_bytes gauge
kube_summary_container_logs_capacity_bytes{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 1.01535985664e+11
kube_summary_container_logs_capacity_bytes{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 1.01535985664e+11
# HELP kube_summary_container_logs_inodes Number of Inodes for logs
# TYPE kube_summary_container_logs_inodes gauge
kube_summary_container_logs_inodes{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 2.5474432e+07
kube_summary_container_logs_inodes{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 2.5474432e+07
# HELP kube_summary_container_logs_inodes_free Number of available Inodes for logs
# TYPE kube_summary_container_logs_inodes_free gauge
kube_summary_container_logs_inodes_free{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 2.5355212e+07
kube_summary_container_logs_inodes_free{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 2.5355212e+07
# HELP kube_summary_container_logs_inodes_used Number of used Inodes for logs
# TYPE kube_summary_container_logs_inodes_used gauge
kube_summary_container_logs_inodes_used{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 1
kube_summary_container_logs_inodes_used{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 1
# HELP kube_summary_container_logs_used_bytes Number of bytes that are consumed by the container logs
# TYPE kube_summary_container_logs_used_bytes gauge
kube_summary_container_logs_used_bytes{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 8192
kube_summary_container_logs_used_bytes{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 8192
# HELP kube_summary_container_rootfs_available_bytes Number of bytes that aren't consumed by the container
# TYPE kube_summary_container_rootfs_available_bytes gauge
kube_summary_container_rootfs_available_bytes{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 9.0016837632e+10
kube_summary_container_rootfs_available_bytes{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 9.0016837632e+10
# HELP kube_summary_container_rootfs_capacity_bytes Number of bytes that can be consumed by the container
# TYPE kube_summary_container_rootfs_capacity_bytes gauge
kube_summary_container_rootfs_capacity_bytes{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 1.01535985664e+11
kube_summary_container_rootfs_capacity_bytes{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 1.01535985664e+11
# HELP kube_summary_container_rootfs_inodes Number of Inodes
# TYPE kube_summary_container_rootfs_inodes gauge
kube_summary_container_rootfs_inodes{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 2.5474432e+07
kube_summary_container_rootfs_inodes{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 2.5474432e+07
# HELP kube_summary_container_rootfs_inodes_free Number of available Inodes
# TYPE kube_summary_container_rootfs_inodes_free gauge
kube_summary_container_rootfs_inodes_free{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 2.5355212e+07
kube_summary_container_rootfs_inodes_free{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 2.5355212e+07
# HELP kube_summary_container_rootfs_inodes_used Number of used Inodes
# TYPE kube_summary_container_rootfs_inodes_used gauge
kube_summary_container_rootfs_inodes_used{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 14
kube_summary_container_rootfs_inodes_used{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 14
# HELP kube_summary_container_rootfs_used_bytes Number of bytes that are consumed by the container
# TYPE kube_summary_container_rootfs_used_bytes gauge
kube_summary_container_rootfs_used_bytes{name="dev-server",namespace="mon",node="",pod="dev-server-0"} 114688
kube_summary_container_rootfs_used_bytes{name="dev-server",namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 114688
# HELP kube_summary_pod_ephemeral_storage_available_bytes Number of bytes of Ephemeral storage that aren't consumed by the pod
# TYPE kube_summary_pod_ephemeral_storage_available_bytes gauge
kube_summary_pod_ephemeral_storage_available_bytes{namespace="mon",node="",pod="dev-server-0"} 9.0016837632e+10
kube_summary_pod_ephemeral_storage_available_bytes{namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 9.0016837632e+10
# HELP kube_summary_pod_ephemeral_storage_capacity_bytes Number of bytes of Ephemeral storage that can be consumed by the pod
# TYPE kube_summary_pod_ephemeral_storage_capacity_bytes gauge
kube_summary_pod_ephemeral_storage_capacity_bytes{namespace="mon",node="",pod="dev-server-0"} 1.01535985664e+11
kube_summary_pod_ephemeral_storage_capacity_bytes{namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 1.01535985664e+11
# HELP kube_summary_pod_ephemeral_storage_inodes Number of Inodes for pod Ephemeral storage
# TYPE kube_summary_pod_ephemeral_storage_inodes gauge
kube_summary_pod_ephemeral_storage_inodes{namespace="mon",node="",pod="dev-server-0"} 2.5474432e+07
kube_summary_pod_ephemeral_storage_inodes{namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 2.5474432e+07
# HELP kube_summary_pod_ephemeral_storage_inodes_free Number of available Inodes for pod Ephemeral storage
# TYPE kube_summary_pod_ephemeral_storage_inodes_free gauge
kube_summary_pod_ephemeral_storage_inodes_free{namespace="mon",node="",pod="dev-server-0"} 2.5355212e+07
kube_summary_pod_ephemeral_storage_inodes_free{namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 2.5355212e+07
# HELP kube_summary_pod_ephemeral_storage_inodes_used Number of used Inodes for pod Ephemeral storage
# TYPE kube_summary_pod_ephemeral_storage_inodes_used gauge
kube_summary_pod_ephemeral_storage_inodes_used{namespace="mon",node="",pod="dev-server-0"} 63
kube_summary_pod_ephemeral_storage_inodes_used{namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 63
# HELP kube_summary_pod_ephemeral_storage_used_bytes Number of bytes of Ephemeral storage that are consumed by the pod
# TYPE kube_summary_pod_ephemeral_storage_used_bytes gauge
kube_summary_pod_ephemeral_storage_used_bytes{namespace="mon",node="",pod="dev-server-0"} 1.33947392e+08
kube_summary_pod_ephemeral_storage_used_bytes{namespace="mon",node="test.eu-west-1.compute.internal",pod="dev-server-0"} 1.33947392e+08
`

d, err := os.ReadFile("test-summary.json")
Expand Down
5 changes: 4 additions & 1 deletion test-summary.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"pods": [
"node": {
"nodeName": "test.eu-west-1.compute.internal"
},
"pods": [
{
"podRef": {
"name": "dev-server-0",
Expand Down

0 comments on commit dd14294

Please sign in to comment.