Skip to content

Commit c9f9fe7

Browse files
committed
Modify test to verify that chunk_step can step into previos max log file
1 parent f378ce3 commit c9f9fe7

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

lib/kernel/test/disk_log_SUITE.erl

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4207,23 +4207,27 @@ otp_16809(Conf) when is_list(Conf) ->
42074207

42084208
decrease_size_with_chunk_step(Conf) when is_list(Conf) ->
42094209
Dir = ?privdir(Conf),
4210-
Log = test,
4210+
Log = decrease_size_with_chunk_step,
42114211
File = filename:join(Dir, lists:concat([Log, ".LOG"])),
4212-
{ok, test} = disk_log:open([{size, {1000, 3}}, {name,Log},{type, wrap},
4213-
{file, File}, {notify, true}]),
4214-
eof = disk_log:chunk(Log,start,1),
4215-
{error, end_of_log} = disk_log:chunk_step(Log,start,1),
4216-
[disk_log:log(Log, X) || X <- lists:seq(1, 1000)],
4212+
{ok, Log} = disk_log:open([{size, {50, 3}}, {name, Log}, {type, wrap},
4213+
{file, File}, {notify, true}]),
4214+
eof = disk_log:chunk(Log, start, 1),
4215+
{error, end_of_log} = disk_log:chunk_step(Log, start, 1),
4216+
ok = disk_log:log_terms(Log, [1, 2, 3, 4, 5, 6, 7, 8, 9]),
42174217
ok = disk_log:close(Log),
4218-
{ok, test} = disk_log:open([{name, Log}, {type, wrap}, {file, File},
4219-
{notify, true}]),
4220-
%% Decrease maximum number of files from 10 to 2.
4221-
ok = disk_log:change_size(Log, {1000, 2}),
4218+
{ok, Log} = disk_log:open([{name, Log}, {type, wrap}, {file, File},
4219+
{notify, true}]),
4220+
%% Decrease maximum number of files from 3 to 2.
4221+
ok = disk_log:change_size(Log, {50, 2}),
42224222
%% The exception error of rem/2 operator should not occur in here.
4223-
{ok, _} = disk_log:chunk_step(Log, start, 1),
4223+
{ok, Cont} = disk_log:chunk_step(Log, start, 2),
4224+
%% Verify that chunk_step has stepped to old max file (3)
4225+
{_, [7, 8, 9]} = disk_log:chunk(Log, Cont),
42244226
%% Continue to append the items to the log in order to make sure it can work
42254227
%% as normal.
4226-
[disk_log:log(Log, X) || X <- lists:seq(1, 5000)],
4228+
ok = disk_log:log_terms(Log, [9, 8, 7, 6, 5, 4, 3, 2, 1]),
4229+
%% Verify that log files were decreased to 2 after wrapping
4230+
[6, 5, 4, 3, 2, 1] = get_all_terms(Log),
42274231
ok = disk_log:close(Log),
42284232
del(File, 2).
42294233

0 commit comments

Comments
 (0)