Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions test/gtest/metadata_exchange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/
#include <gtest/gtest.h>
#include <algorithm>
#include <thread>
#include <random>
#include "nixl.h"
Expand Down Expand Up @@ -138,11 +139,9 @@ class MetadataExchangeTestFixture : public testing::Test {

void TearDown() override
{
for (auto &agent : agents_) {
if (agent.agent) {
agent.agent->invalidateLocalMD(nullptr);
}
}
// Destroying an agent does not require invalidating its metadata, so the
// fixture does not do it: a test that publishes metadata invalidates it
// through the same route it published on.
std::this_thread::sleep_for(std::chrono::milliseconds(500));
agents_.clear();
}
Expand Down Expand Up @@ -497,6 +496,12 @@ TEST_F(MetadataExchangeTestFixture, SocketSendPartialLocal) {
ASSERT_EQ(dst.agent->checkRemoteMD(src.name, valid_descs.trim()), NIXL_SUCCESS);

ASSERT_EQ(dst.agent->checkRemoteMD(src.name, invalid_descs.trim()), NIXL_ERR_NOT_FOUND);

ASSERT_EQ(src.agent->invalidateLocalMD(&send_args), NIXL_SUCCESS);

std::this_thread::sleep_for(sleep_time);

ASSERT_EQ(dst.agent->checkRemoteMD(src.name, {DRAM_SEG}), NIXL_ERR_NOT_FOUND);
}

TEST_F(MetadataExchangeTestFixture, SocketSendLocalPartialWithErrors) {
Expand Down Expand Up @@ -550,10 +555,20 @@ TEST_F(MetadataExchangeTestFixture, LocalNonLocalMDExchange) {
auto &src = agents_[0];
auto &dst = agents_[1];

std::vector<nixl_backend_t> plugins;
ASSERT_EQ(src.agent->getAvailPlugins(plugins), NIXL_SUCCESS);

nixl_status_t status = NIXL_ERR_NOT_FOUND;
nixlBackendH *backend;
std::string backend_name;
for (const auto& name : std::set<std::string>{"GDS", "POSIX"}) {
// Requesting a backend the plugin manager does not list warns once per
// plugin directory and then reports an unsupported backend, so only ask
// for the local-only plugins it actually found.
if (std::find(plugins.begin(), plugins.end(), name) == plugins.end()) {
continue;
}

const LogIgnoreGuard lig1("cuFileDriverOpen failed");
const LogIgnoreGuard lig2("createBackend: backend initialization error for 'GDS'");
status = src.agent->createBackend(name, {}, backend);
Expand Down Expand Up @@ -632,10 +647,6 @@ TEST_F(MetadataExchangeTestFixture, EtcdSendLocalAndFetchRemote) {
EXPECT_EQ(lig1.getIgnoredCount(), 1);
EXPECT_EQ(lig2.getIgnoredCount(), 1);
}

// Prevent invalidateLocalMD() from begin called again in TearDown()
// (which would generate more undesired warning/error log messages).
src.agent.reset();
}

TEST_F(MetadataExchangeTestFixture, EtcdSendLocalPartialAndFetchRemote) {
Expand Down Expand Up @@ -725,10 +736,6 @@ TEST_F(MetadataExchangeTestFixture, EtcdSendLocalPartialAndFetchRemote) {
std::this_thread::sleep_for(sleep_time);

ASSERT_EQ(dst.agent->checkRemoteMD(src.name, valid_descs.trim()), NIXL_ERR_NOT_FOUND);

// Prevent invalidateLocalMD() from begin called again in TearDown()
// (which would generate more undesired warning/error log messages).
src.agent.reset();
}

TEST_F(MetadataExchangeTestFixture, EtcdSendLocalPartialAndFetchRemoteWithErrors) {
Expand Down Expand Up @@ -789,6 +796,9 @@ TEST_F(MetadataExchangeTestFixture, EtcdSendLocalPartialAndFetchRemoteWithErrors
EXPECT_EQ(lig1.getIgnoredCount(), 1);
EXPECT_EQ(lig2.getIgnoredCount(), 1);
}

// Remove the label published in case 2, so the agent name is reusable.
ASSERT_EQ(src.agent->invalidateLocalMD(), NIXL_SUCCESS);
}

} // namespace metadata_exchange
Expand Down
Loading