Skip to content

Instantly share code, notes, and snippets.

@neilconway
Created October 13, 2015 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilconway/96a94661e485dcade2ad to your computer and use it in GitHub Desktop.
Save neilconway/96a94661e485dcade2ad to your computer and use it in GitHub Desktop.
class MockReplica : public Replica
{
public:
explicit MockReplica(const string& path) :
Replica(path)
{
EXPECT_CALL(*this, update(_))
.WillRepeatedly(Invoke(this, &MockReplica::_update));
}
virtual ~MockReplica() {}
MOCK_METHOD1(update, process::Future<bool>(const Metadata::Status& status));
process::Future<bool> _update(const Metadata::Status& status)
{
return Replica::update(status);
}
};
TEST_F(CoordinatorTest, RecoveryRaceDummy)
{
const string path1 = os::getcwd() + "/.log1";
MockReplica* replica1 = new MockReplica(path1);
Future<bool> r1Ready;
Promise<bool> r1Continue;
EXPECT_CALL(*replica1, update(_))
.WillOnce(DoAll(IgnoreResult(FutureResult(&r1Ready,
Invoke(replica1,
&MockReplica::_update))),
Return(r1Continue.future())));
}
@neilconway
Copy link
Author

In file included from ../../mesos/src/tests/log_tests.cpp:28:
../../mesos/3rdparty/libprocess/include/process/future.hpp:863:7: error: no viable conversion from 'const testing::internal::IgnoredValue' to 'const bool'
set(u);
^
../../mesos/3rdparty/libprocess/include/process/gmock.hpp:180:19: note: in instantiation of function template specialization 'process::Future::Futuretesting::internal::IgnoredValue' requested here
promise.set(result);
^
../../mesos/3rdparty/libprocess/include/process/gmock.hpp:169:14: note: in instantiation of member function 'FutureResultAction<bool, testing::PolymorphicAction<testing::internal::InvokeMethodAction<mesos::internal::tests::MockReplica, process::Future (mesos::internal::tests::MockReplica::)(const mesos::internal::log::Metadata_Status &)> > >::Implementation<testing::internal::IgnoredValue (const mesos::internal::log::Metadata_Status &)>::Perform' requested here
explicit Implementation(process::Future
future, const A& action)
^
../../mesos/3rdparty/libprocess/include/process/gmock.hpp:161:37: note: in instantiation of member function 'FutureResultAction<bool, testing::PolymorphicAction<testing::internal::InvokeMethodAction<mesos::internal::tests::MockReplica, process::Future (mesos::internal::tests::MockReplica::)(const mesos::internal::log::Metadata_Status &)> > >::Implementation<testing::internal::IgnoredValue (const mesos::internal::log::Metadata_Status &)>::Implementation' requested here
return ::testing::Action(new Implementation(future, action));
^
../3rdparty/libprocess/3rdparty/gmock-1.7.0/include/gmock/gmock-actions.h:801:46: note: in instantiation of function template specialization 'FutureResultAction<bool, testing::PolymorphicAction<testing::internal::InvokeMethodAction<mesos::internal::tests::MockReplica, process::Future (mesos::internal::tests::MockReplica::
)(const mesos::internal::log::Metadata_Status &)> > >::operator Action<testing::internal::IgnoredValue (const mesos::internal::log::Metadata_Status &)>' requested here
explicit Impl(const A& action) : action_(action) {}
^
../3rdparty/libprocess/3rdparty/gmock-1.7.0/include/gmock/gmock-actions.h:791:26: note: in instantiation of member function 'testing::internal::IgnoreResultAction<FutureResultAction<bool, testing::PolymorphicAction<testing::internal::InvokeMethodAction<mesos::internal::tests::MockReplica, process::Future (mesos::internal::tests::MockReplica::)(const mesos::internal::log::Metadata_Status &)> > > >::Impl<void (const mesos::internal::log::Metadata_Status &)>::Impl' requested here
return Action(new Impl(action
));
^
../3rdparty/libprocess/3rdparty/gmock-1.7.0/include/gmock/gmock-actions.h:863:34: note: in instantiation of function template specialization 'testing::internal::IgnoreResultAction<FutureResultAction<bool, testing::PolymorphicAction<testing::internal::InvokeMethodAction<mesos::internal::tests::MockReplica, process::Future (mesos::internal::tests::MockReplica::)(const mesos::internal::log::Metadata_Status &)> > > >::operator Action<void (const mesos::internal::log::Metadata_Status &)>' requested here
return Action(new Impl(action1
, action2_));
^
../../mesos/src/tests/log_tests.cpp:680:15: note: in instantiation of function template specialization 'testing::internal::DoBothAction<testing::internal::IgnoreResultAction<FutureResultAction<bool, testing::PolymorphicAction<testing::internal::InvokeMethodAction<mesos::internal::tests::MockReplica, process::Future (mesos::internal::tests::MockReplica::*)(const mesos::internal::log::Metadata_Status &)> > > >, testing::internal::ReturnActionprocess::Future >::operator Actionprocess::Future<bool (const mesos::internal::log::Metadata_Status &)>' requested here
.WillOnce(DoAll(IgnoreResult(FutureResult(&r1Ready,
^
../../mesos/3rdparty/libprocess/include/process/future.hpp:426:21: note: passing argument to parameter '_t' here
bool set(const T& _t);
^
1 error generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment