Skip to content

Commit 72ac9c9

Browse files
committed
TMP
1 parent 120f5c4 commit 72ac9c9

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/e2e/metriconly/metrics_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,34 @@ var _ = ginkgo.Describe("NPD should export Prometheus metrics.", func() {
117117
})
118118
})
119119

120+
ginkgo.Context("When ext4 filesystem error happens", func() {
121+
122+
ginkgo.BeforeEach(func() {
123+
err := npd.WaitForNPD(instance, []string{"problem_gauge"}, 120)
124+
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Expect NPD to become ready in 120s, but hit error: %v", err))
125+
// This will trigger a ext4 error on the boot disk, causing the boot disk mounted as read-only and systemd-journald crashing.
126+
instance.RunCommandOrFail("sudo /home/kubernetes/bin/problem-maker --problem Ext4FilesystemError")
127+
})
128+
129+
ginkgo.It("NPD should update problem_counter{reason:Ext4Error} and problem_gauge{type:ReadonlyFilesystem}", func() {
130+
//ginkgo.Skip("Writing to /sys/fs/ext4/sda1/trigger_fs_error breaks SSH: https://github.com/kubernetes/node-problem-detector/issues/970")
131+
time.Sleep(5 * time.Second)
132+
assertMetricValueAtLeast(instance,
133+
"problem_counter", map[string]string{"reason": "Ext4Error"},
134+
1.0)
135+
assertMetricValueInBound(instance,
136+
"problem_gauge", map[string]string{"reason": "FilesystemIsReadOnly", "type": "ReadonlyFilesystem"},
137+
1.0, 1.0)
138+
})
139+
140+
ginkgo.It("NPD should remain healthy", func() {
141+
//ginkgo.Skip("Writing to /sys/fs/ext4/sda1/trigger_fs_error breaks SSH: https://github.com/kubernetes/node-problem-detector/issues/970")
142+
npdStates := instance.RunCommandOrFail("sudo systemctl show node-problem-detector -p ActiveState -p SubState")
143+
Expect(npdStates.Stdout).To(ContainSubstring("ActiveState=active"), "NPD is no longer active: %v", npdStates)
144+
Expect(npdStates.Stdout).To(ContainSubstring("SubState=running"), "NPD is no longer running: %v", npdStates)
145+
})
146+
})
147+
120148
ginkgo.Context("When OOM kills and docker hung happen", func() {
121149

122150
ginkgo.BeforeEach(func() {

0 commit comments

Comments
 (0)