Skip to content

Commit 0df8863

Browse files
authored
Fix unit_query_plan test (#4666)
This test was failing when re-run after a failure because it does not attempt to remove the existing array directory that may exist. This just adds the obvious fix of removing the `query_plan_array` directory at the beginning of the test. --- TYPE: NO_HISTORY DESC: Fix unit_query_plan
1 parent 798a939 commit 0df8863

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tiledb/sm/query_plan/test/unit_query_plan.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* This file tests the QueryPlan class
3131
*/
3232

33+
#include <test/support/src/temporary_local_directory.h>
3334
#include <test/support/tdb_catch.h>
3435
#include "../query_plan.h"
3536
#include "external/include/nlohmann/json.hpp"
@@ -55,6 +56,10 @@ struct QueryPlanFx {
5556

5657
void destroy_array(const std::shared_ptr<Array>& array);
5758

59+
URI array_uri(const std::string& uri);
60+
61+
TemporaryLocalDirectory temp_dir_;
62+
5863
Config cfg_;
5964
shared_ptr<Logger> logger_;
6065
ContextResources resources_;
@@ -97,7 +102,10 @@ tdb_unique_ptr<Array> QueryPlanFx::create_array(const URI uri) {
97102

98103
void QueryPlanFx::destroy_array(const std::shared_ptr<Array>& array) {
99104
REQUIRE(array->close().ok());
100-
REQUIRE(sm_->vfs()->remove_dir(array->array_uri()).ok());
105+
}
106+
107+
URI QueryPlanFx::array_uri(const std::string& array_name) {
108+
return URI(temp_dir_.path() + array_name);
101109
}
102110

103111
QueryPlanFx::QueryPlanFx()
@@ -107,7 +115,7 @@ QueryPlanFx::QueryPlanFx()
107115
}
108116

109117
TEST_CASE_METHOD(QueryPlanFx, "Query plan dump_json", "[query_plan][dump]") {
110-
const URI uri = URI("query_plan_array");
118+
const URI uri = array_uri("query_plan_array");
111119

112120
auto array = create_array(uri);
113121

0 commit comments

Comments
 (0)