summaryrefslogtreecommitdiff
path: root/lib/os_mon/test
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <egil@erlang.org>2013-07-19 18:03:45 +0200
committerBjörn-Egil Dahlberg <egil@erlang.org>2013-07-19 18:32:04 +0200
commit214e1bc1205621b8f802b8c3ac7e95f1717712cb (patch)
tree5f723a84f1b1aea018402b19a050c1d208ee2ed4 /lib/os_mon/test
parente1b4b145a5eadfe7cc109e66931f3050d85cba47 (diff)
downloaderlang-214e1bc1205621b8f802b8c3ac7e95f1717712cb.tar.gz
os_mon: Relax disksup_SUITE test even more
Capacity can be zero on certain filesystems. Remove reported mountpoints with zero capacity during tests since these reports false positives.
Diffstat (limited to 'lib/os_mon/test')
-rw-r--r--lib/os_mon/test/disksup_SUITE.erl42
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/os_mon/test/disksup_SUITE.erl b/lib/os_mon/test/disksup_SUITE.erl
index d985e22d14..9c65d8b692 100644
--- a/lib/os_mon/test/disksup_SUITE.erl
+++ b/lib/os_mon/test/disksup_SUITE.erl
@@ -83,23 +83,12 @@ api(doc) -> ["Test of API functions"];
api(Config) when is_list(Config) ->
%% get_disk_data()
- Data = disksup:get_disk_data(),
- case lists:keysearch("/ldisk", 1, Data) of
- {value,{Id,KByte,Capacity}} ->
- true = io_lib:printable_list(Id),
- true = is_integer(KByte),
- true = is_integer(Capacity),
- true = Capacity>0,
- true = KByte>0;
- _ ->
- [{Id, KByte, Capacity}|_] = Data,
- true = io_lib:printable_list(Id),
- true = is_integer(KByte),
- true = is_integer(Capacity),
- % can be zero
- % true = Capacity>0,
- true = KByte>0
- end,
+ [{Id,KByte,Capacity}|_] = get_disk_data(),
+ true = io_lib:printable_list(Id),
+ true = is_integer(KByte),
+ true = is_integer(Capacity),
+ true = Capacity>0,
+ true = KByte>0,
%% get_check_interval()
1800000 = disksup:get_check_interval(),
@@ -315,8 +304,7 @@ port(Config) when is_list(Config) ->
%% Give os_mon_sup time to restart disksup
?t:sleep(?t:seconds(3)),
- [{_Disk2,Kbyte2,_Cap2}|_] =
- disksup:get_disk_data(),
+ [{_Disk2,Kbyte2,_Cap2}|_] = disksup:get_disk_data(),
true = Kbyte2>0,
ok;
@@ -395,8 +383,7 @@ otp_5910(Config) when is_list(Config) ->
Data3 = disksup:get_disk_data(),
Alarms2 = get_alarms(),
if
- length(Alarms2)==length(Alarms) ->
- ok;
+ length(Alarms2)==length(Alarms) -> ok;
true ->
dump_info(),
?t:fail({bad_alarms,Threshold,Data3,Alarms,Alarms2})
@@ -419,3 +406,16 @@ otp_5910(Config) when is_list(Config) ->
dump_info() ->
io:format("Status: ~p~n", [sys:get_status(disksup)]).
+
+% filter get_disk_data and remove entriew with zero capacity
+% "non-normal" filesystems report zero capacity
+% - Perhaps errorneous 'df -k -l'?
+% - Always list filesystems by type '-t ufs,zfs,..' instead?
+% It is unclear what the intention was from the beginning.
+get_disk_data() ->
+ get_disk_data(disksup:get_disk_data()).
+
+get_disk_data([{"none",0,0}=E]) -> [E];
+get_disk_data([{_,_,0}|Es]) -> get_disk_data(Es);
+get_disk_data([E|Es]) -> [E|get_disk_data(Es)];
+get_disk_data([]) -> [].