Skip to content

Commit 9c50b25

Browse files
authored
Merge pull request kubernetes#124009 from bart0sh/PR136-remove-Dbus-test-case
e2e_node: remove `Dbus` test case
2 parents a309fad + 9ce994a commit 9c50b25

File tree

3 files changed

+0
-104
lines changed

3 files changed

+0
-104
lines changed

test/e2e_node/node_shutdown_linux_test.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"fmt"
2525
"os"
2626
"os/exec"
27-
"path/filepath"
2827
"regexp"
2928
"strconv"
3029
"time"
@@ -652,44 +651,6 @@ func getNodeReadyStatus(ctx context.Context, f *framework.Framework) bool {
652651
return isNodeReady(&nodeList.Items[0])
653652
}
654653

655-
func systemctlDaemonReload() error {
656-
cmd := "systemctl daemon-reload"
657-
_, err := runCommand("sh", "-c", cmd)
658-
return err
659-
}
660-
661-
var (
662-
dbusConfPath = "/etc/systemd/system/dbus.service.d/k8s-graceful-node-shutdown-e2e.conf"
663-
dbusConf = `
664-
[Unit]
665-
RefuseManualStart=no
666-
RefuseManualStop=no
667-
[Service]
668-
KillMode=control-group
669-
ExecStop=
670-
`
671-
)
672-
673-
func overlayDbusConfig() error {
674-
err := os.MkdirAll(filepath.Dir(dbusConfPath), 0755)
675-
if err != nil {
676-
return err
677-
}
678-
err = os.WriteFile(dbusConfPath, []byte(dbusConf), 0644)
679-
if err != nil {
680-
return err
681-
}
682-
return systemctlDaemonReload()
683-
}
684-
685-
func restoreDbusConfig() error {
686-
err := os.Remove(dbusConfPath)
687-
if err != nil {
688-
return err
689-
}
690-
return systemctlDaemonReload()
691-
}
692-
693654
const (
694655
// https://github.com/kubernetes/kubernetes/blob/1dd781ddcad454cc381806fbc6bd5eba8fa368d7/pkg/kubelet/nodeshutdown/nodeshutdown_manager_linux.go#L43-L44
695656
podShutdownReason = "Terminated"

test/e2e_node/restart_test.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -147,61 +147,6 @@ var _ = SIGDescribe("Restart", framework.WithSerial(), framework.WithSlow(), fra
147147
})
148148
})
149149
})
150-
151-
ginkgo.Context("Dbus", func() {
152-
ginkgo.It("should continue to run pods after a restart", func(ctx context.Context) {
153-
// Allow dbus to be restarted on ubuntu
154-
err := overlayDbusConfig()
155-
framework.ExpectNoError(err)
156-
defer func() {
157-
err := restoreDbusConfig()
158-
framework.ExpectNoError(err)
159-
}()
160-
161-
preRestartPodCount := 2
162-
ginkgo.By(fmt.Sprintf("creating %d RestartAlways pods on node", preRestartPodCount))
163-
restartAlwaysPods := newTestPods(preRestartPodCount, false, imageutils.GetPauseImageName(), "restart-dbus-test")
164-
createBatchPodWithRateControl(ctx, f, restartAlwaysPods, podCreationInterval)
165-
ginkgo.DeferCleanup(deletePodsSync, f, restartAlwaysPods)
166-
167-
allPods := waitForPodsCondition(ctx, f, preRestartPodCount, startTimeout, testutils.PodRunningReadyOrSucceeded)
168-
if len(allPods) < preRestartPodCount {
169-
framework.Failf("Failed to run sufficient restartAlways pods, got %d but expected %d", len(allPods), preRestartPodCount)
170-
}
171-
172-
ginkgo.By("restarting dbus and systemd", func() {
173-
stdout, err := exec.Command("sudo", "systemctl", "reset-failed", "dbus").CombinedOutput()
174-
framework.ExpectNoError(err, "Failed to reset dbus start-limit with systemctl: %v, %s", err, string(stdout))
175-
176-
stdout, err = exec.Command("sudo", "systemctl", "restart", "dbus").CombinedOutput()
177-
framework.ExpectNoError(err, "Failed to restart dbus with systemctl: %v, %s", err, string(stdout))
178-
179-
stdout, err = exec.Command("sudo", "systemctl", "daemon-reexec").CombinedOutput()
180-
framework.ExpectNoError(err, "Failed to restart systemd with systemctl: %v, %s", err, string(stdout))
181-
})
182-
183-
ginkgo.By("verifying restartAlways pods stay running", func() {
184-
for start := time.Now(); time.Since(start) < startTimeout && ctx.Err() == nil; time.Sleep(10 * time.Second) {
185-
postRestartRunningPods := waitForPodsCondition(ctx, f, preRestartPodCount, recoverTimeout, testutils.PodRunningReadyOrSucceeded)
186-
if len(postRestartRunningPods) < preRestartPodCount {
187-
framework.Failf("fewer pods are running after systemd restart, got %d but expected %d", len(postRestartRunningPods), preRestartPodCount)
188-
}
189-
}
190-
})
191-
192-
ginkgo.By("verifying new pods can be started after a dbus restart")
193-
postRestartPodCount := 2
194-
postRestartPods := newTestPods(postRestartPodCount, false, imageutils.GetPauseImageName(), "restart-dbus-test")
195-
createBatchPodWithRateControl(ctx, f, postRestartPods, podCreationInterval)
196-
ginkgo.DeferCleanup(deletePodsSync, f, postRestartPods)
197-
198-
allPods = waitForPodsCondition(ctx, f, preRestartPodCount+postRestartPodCount, startTimeout, testutils.PodRunningReadyOrSucceeded)
199-
if len(allPods) < preRestartPodCount+postRestartPodCount {
200-
framework.Failf("Failed to run pods after restarting dbus, got %d but expected %d", len(allPods), preRestartPodCount+postRestartPodCount)
201-
}
202-
})
203-
})
204-
205150
ginkgo.Context("Kubelet", func() {
206151
ginkgo.It("should correctly account for terminated pods after restart", func(ctx context.Context) {
207152
node := getLocalNode(ctx, f)

test/e2e_node/util.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,6 @@ func logKubeletLatencyMetrics(ctx context.Context, metricNames ...string) {
316316
}
317317
}
318318

319-
// runCommand runs the cmd and returns the combined stdout and stderr, or an
320-
// error if the command failed.
321-
func runCommand(cmd ...string) (string, error) {
322-
output, err := exec.Command(cmd[0], cmd[1:]...).CombinedOutput()
323-
if err != nil {
324-
return "", fmt.Errorf("failed to run %q: %s (%s)", strings.Join(cmd, " "), err, output)
325-
}
326-
return string(output), nil
327-
}
328-
329319
// getCRIClient connects CRI and returns CRI runtime service clients and image service client.
330320
func getCRIClient() (internalapi.RuntimeService, internalapi.ImageManagerService, error) {
331321
// connection timeout for CRI service connection

0 commit comments

Comments
 (0)