@@ -117,6 +117,34 @@ var _ = ginkgo.Describe("NPD should export Prometheus metrics.", func() {
117
117
})
118
118
})
119
119
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
+
120
148
ginkgo .Context ("When OOM kills and docker hung happen" , func () {
121
149
122
150
ginkgo .BeforeEach (func () {
0 commit comments