From 87faa00a14fe85217dcfabfcf5176e6b773c4142 Mon Sep 17 00:00:00 2001 From: Zhen Wang Date: Mon, 4 Mar 2019 15:26:21 -0800 Subject: [PATCH] Fix NPD E2E test on clusters with Ubuntu nodes --- test/e2e/node/node_problem_detector.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/e2e/node/node_problem_detector.go b/test/e2e/node/node_problem_detector.go index 9244e56794a..b4d2434c098 100644 --- a/test/e2e/node/node_problem_detector.go +++ b/test/e2e/node/node_problem_detector.go @@ -70,11 +70,14 @@ var _ = SIGDescribe("NodeProblemDetector", func() { workingSetStats[host] = []float64{} By(fmt.Sprintf("Check node %q has node-problem-detector process", host)) - psCmd := "ps aux | grep node-problem-detector" + // Using brackets "[n]" is a trick to prevent grep command itself from + // showing up, because string text "[n]ode-problem-detector" does not + // match regular expression "[n]ode-problem-detector". + psCmd := "ps aux | grep [n]ode-problem-detector" result, err := framework.SSH(psCmd, host, framework.TestContext.Provider) framework.ExpectNoError(err) Expect(result.Code).To(BeZero()) - Expect(result.Stdout).To(ContainSubstring("/home/kubernetes/bin/node-problem-detector")) + Expect(result.Stdout).To(ContainSubstring("node-problem-detector")) By(fmt.Sprintf("Check node-problem-detector is running fine on node %q", host)) journalctlCmd := "sudo journalctl -u node-problem-detector"