Skip to content

Commit

Permalink
Add remote scan test (without forwarding)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisspyB committed Nov 26, 2024
1 parent 0f29c10 commit 6f5a5ab
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tests/remote/test_remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ CASE( "Remote protocol: axes" ) {

}

CASE( "Remote protocol: scan" ) {

std::vector<metkit::mars::MarsRequest> requests;

for (auto& r : fdb5::FDBToolRequest::requestsFromString("class=rd,expver=xxxx")) {
requests.push_back(r.request());
}

GribJump gribjump;
LogContext ctx("test_scan");
size_t nfields = gribjump.scan(requests, false, ctx);
EXPECT_EQUAL(nfields, 3);
}

#ifdef GRIBJUMP_HAVE_DHSKIT // metrics target is set by dhskit

CASE( "Parse the metrics file" ) {
Expand All @@ -112,7 +126,7 @@ CASE( "Parse the metrics file" ) {
"context"
};

// Expect 2 JSON objects in the file
// Expect one JSON object in the file, per test case above
std::vector<eckit::Value> values;
std::ifstream file(metricsFile.asString().c_str());
std::string line;
Expand All @@ -126,7 +140,7 @@ CASE( "Parse the metrics file" ) {
EXPECT(v.contains(key));
}
}
EXPECT_EQUAL(values.size(), 2);
EXPECT_EQUAL(values.size(), 3);
// Check extract
eckit::Value v = values[0];
EXPECT_EQUAL(v["action"], "extract");
Expand All @@ -137,6 +151,10 @@ CASE( "Parse the metrics file" ) {
EXPECT_EQUAL(v["action"], "axes");
EXPECT_EQUAL(v["context"], "test_axes");

// Check scan
v = values[2];
EXPECT_EQUAL(v["action"], "scan");
EXPECT_EQUAL(v["context"], "test_scan");
}
#endif
} // namespace test
Expand Down

0 comments on commit 6f5a5ab

Please sign in to comment.