Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix inodes test #142

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 8 additions & 27 deletions tests/e2e/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,30 +232,6 @@ func getContainerVolumeUsage(podName string) float64 {
return currentPodSize
}

func getInodes(podName string) float64 {
output := requestPrometheusString()
re := regexp.MustCompile(fmt.Sprintf(`ephemeral_storage_inodes.+pod_name="%s.+\}\s(.+)`, podName))
match := re.FindAllStringSubmatch(output, 2)
inodes, _ := strconv.ParseFloat(match[0][1], 64)
return inodes
}

func getInodesFree(podName string) float64 {
output := requestPrometheusString()
re := regexp.MustCompile(fmt.Sprintf(`ephemeral_storage_inodes_free.+pod_name="%s.+\}\s(.+)`, podName))
match := re.FindAllStringSubmatch(output, 2)
inodesFree, _ := strconv.ParseFloat(match[0][1], 64)
return inodesFree
}

func getInodesUsed(podName string) float64 {
output := requestPrometheusString()
re := regexp.MustCompile(fmt.Sprintf(`ephemeral_storage_inodes_used.+pod_name="%s.+\}\s(.+)`, podName))
match := re.FindAllStringSubmatch(output, 2)
inodesUsed, _ := strconv.ParseFloat(match[0][1], 64)
return inodesUsed
}

func WatchEphemeralSize(podName string, desiredSizeChange float64, timeout time.Duration, getPodSize getPodSize) {
// Watch Prometheus Metrics until the ephemeral storage shrinks or grows to a certain desiredSizeChange.
var currentPodSize float64
Expand Down Expand Up @@ -322,14 +298,19 @@ var _ = ginkgo.Describe("Test Metrics\n", func() {
ginkgo.Specify("\nMake sure all metrics are in the exporter", func() {
var checkSlice []string
checkSlice = append(checkSlice, "ephemeral_storage_pod_usage",
"pod_name=\"k8s-ephemeral-storage",
"ephemeral_storage_adjusted_polling_rate",
"node_name=\"minikube",
"ephemeral_storage_node_available",
"ephemeral_storage_node_capacity",
"ephemeral_storage_node_percentage",
"pod_name=\"k8s-ephemeral-storage", "ephemeral_storage_adjusted_polling_rate",
"node_name=\"minikube",
"ephemeral_storage_container_limit_percentage",
"ephemeral_storage_container_volume_limit_percentage",
"ephemeral_storage_container_volume_usage")
"ephemeral_storage_container_volume_usage",
"ephemeral_storage_inodes",
"ephemeral_storage_inodes_free",
"ephemeral_storage_inodes_used",
)
checkPrometheus(checkSlice, false)
})
})
Expand Down
Loading