diff --git a/tests/ts_simple_query_buffers_SUITE.erl b/tests/ts_simple_query_buffers_SUITE.erl index a033762a..3af7b751 100644 --- a/tests/ts_simple_query_buffers_SUITE.erl +++ b/tests/ts_simple_query_buffers_SUITE.erl @@ -216,10 +216,7 @@ init_per_testcase(query_orderby_max_data_size_error, Cfg) -> init_per_testcase(query_orderby_ldb_io_error, Cfg) -> Node = hd(proplists:get_value(cluster, Cfg)), QBufDir = filename:join([rtdev:node_path(Node), "data/query_buffers"]), - Cmd = get_write_perm_cmd(take_away, QBufDir), - ct:log("running ~s", [Cmd]), - CmdOut = "" = os:cmd(Cmd), - ct:log("~s: '~s'", [Cmd, CmdOut]), + modify_dir_access(take_away, QBufDir), Cfg; init_per_testcase(_, Cfg) -> @@ -238,10 +235,7 @@ end_per_testcase(query_orderby_max_data_size_error, Cfg) -> end_per_testcase(query_orderby_ldb_io_error, Cfg) -> Node = hd(proplists:get_value(cluster, Cfg)), QBufDir = filename:join([rtdev:node_path(Node), "data/query_buffers"]), - Cmd = get_write_perm_cmd(give_back, QBufDir), - ct:log("running ~s", [Cmd]), - CmdOut = "" = os:cmd(Cmd), - ct:log("~s: '~s'", [Cmd, CmdOut]), + modify_dir_access(give_back, QBufDir), ok; end_per_testcase(_, Cfg) -> Cfg. @@ -392,12 +386,14 @@ col_no({[A|_], _}) -> col_no({[A|_], _, _}) -> A - $a + 1. -fmt(F, A) -> - lists:flatten(io_lib:format(F, A)). -get_write_perm_cmd(take_away, QBufDir) -> - ct:pal("take away perms on ~s\n", [QBufDir]), - fmt("sh -c \"mv '~s' '~s.boo' && touch '~s'\"", [QBufDir, QBufDir, QBufDir]); -get_write_perm_cmd(give_back, QBufDir) -> - ct:pal("restore perms on ~s\n", [QBufDir]), - fmt("sh -c \"rm '~s' && mv '~s.boo' '~s'\"", [QBufDir, QBufDir, QBufDir]). +modify_dir_access(take_away, QBufDir) -> + ct:pal("take away access to ~s\n", [QBufDir]), + file:rename(QBufDir, QBufDir++".boo"), + file:write_file(QBufDir, "nothing here"); + +modify_dir_access(give_back, QBufDir) -> + ct:pal("restore access to ~s\n", [QBufDir]), + file:delete(QBufDir), + file:rename(QBufDir++".boo", QBufDir). +