mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Avoid disk eviction node e2e test using up all the disk space
This commit is contained in:
@@ -18,10 +18,7 @@ package e2e_node
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -118,31 +115,20 @@ var _ = framework.KubeDescribe("Kubelet", func() {
|
||||
volumeNamePrefix := "test-empty-dir"
|
||||
podNames, volumes := createSummaryTestPods(f.PodClient(), podNamePrefix, 2, volumeNamePrefix)
|
||||
By("Returning stats summary")
|
||||
summary := stats.Summary{}
|
||||
Eventually(func() error {
|
||||
resp, err := http.Get(*kubeletAddress + "/stats/summary")
|
||||
summary, err := getNodeSummary()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to get /stats/summary - %v", err)
|
||||
return fmt.Errorf("failed to get node summary: %v", err)
|
||||
}
|
||||
contentsBytes, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to read /stats/summary - %+v", resp)
|
||||
}
|
||||
contents := string(contentsBytes)
|
||||
decoder := json.NewDecoder(strings.NewReader(contents))
|
||||
err = decoder.Decode(&summary)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse /stats/summary to go struct: %+v", resp)
|
||||
}
|
||||
missingPods := podsMissingFromSummary(summary, podNames)
|
||||
missingPods := podsMissingFromSummary(*summary, podNames)
|
||||
if missingPods.Len() != 0 {
|
||||
return fmt.Errorf("expected pods not found. Following pods are missing - %v", missingPods)
|
||||
}
|
||||
missingVolumes := volumesMissingFromSummary(summary, volumes)
|
||||
missingVolumes := volumesMissingFromSummary(*summary, volumes)
|
||||
if missingVolumes.Len() != 0 {
|
||||
return fmt.Errorf("expected volumes not found. Following volumes are missing - %v", missingVolumes)
|
||||
}
|
||||
if err := testSummaryMetrics(summary, podNamePrefix); err != nil {
|
||||
if err := testSummaryMetrics(*summary, podNamePrefix); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user