// OVS-2204: there were errors even on retry with a new connection which actually // should have succeeded - try to get to the bottom of that TEST_F(BackendInterfaceTest, retry_on_error) { const std::string oname("some-object"); const fs::path opath(path_ / oname); const yt::CheckSum cs(createTestFile(opath, 4096, "some pattern")); yt::CheckSum wrong_cs(1); ASSERT_NE(wrong_cs, cs); std::unique_ptr<be::BackendTestSetup::WithRandomNamespace> nspace(make_random_namespace()); const size_t retries = 7; ASSERT_LE(retries, cm_->capacity()); be::BackendInterfacePtr bi(cm_->newBackendInterface(nspace->ns(), retries)); ASSERT_THROW(bi->write(opath, oname, OverwriteObject::F, &wrong_cs), be::BackendInputException); ASSERT_EQ(retries + 1, cm_->size()); }
// OVS-2204: for some reason the count of open fds goes up after an error, but // valgrind does not report a leak. Try to figure our what's going on here. TEST_F(ConnectionManagerTest, limited_pool_on_errors) { std::async(std::launch::async, [&] { pin_to_cpu_0(); const std::string oname("some-object"); const fs::path opath(path_ / oname); const yt::CheckSum cs(createTestFile(opath, 4096, "some pattern")); yt::CheckSum wrong_cs(1); ASSERT_NE(wrong_cs, cs); std::unique_ptr<be::BackendTestSetup::WithRandomNamespace> nspace(make_random_namespace()); be::BackendInterfacePtr bi(bi_(nspace->ns())); const size_t count = 2 * cm_->capacity(); for (size_t i = 0; i < count; ++i) { ASSERT_THROW(bi->write(opath, oname, OverwriteObject::F, &wrong_cs), be::BackendInputException); } ASSERT_EQ(cm_->capacity() / cm_->shards(), cm_->size()); }).wait(); }
TEST_F(BackendObjectTest, checksum_mismatch) { const std::string oname("some-object"); const fs::path opath(path_ / oname); const yt::CheckSum cs(createTestFile(opath, 4096, "some pattern")); BackendInterfacePtr bi(bi_(nspace_->ns())); yt::CheckSum wrong_cs(1); ASSERT_NE(wrong_cs, cs); ASSERT_THROW(bi->write(opath, oname, OverwriteObject::F, &wrong_cs), BackendInputException); ASSERT_FALSE(bi->objectExists(oname)); }