1919#include " callback.hpp"
2020#include " name_resolver.hpp"
2121
22- #ifdef WIN32
23- #include " winsock.h"
24- #endif
25-
2622#define RESOLVE_TIMEOUT 2000
2723
2824using namespace datastax ;
@@ -54,21 +50,15 @@ class NameResolverUnitTest : public LoopTest {
5450};
5551
5652TEST_F (NameResolverUnitTest, Simple) {
57- NameResolver::Ptr resolver (create (Address (" 127.0.0.1 " , 9042 )));
53+ NameResolver::Ptr resolver (create (Address (" 127.254.254.254 " , 9042 )));
5854 resolver->resolve (loop (), RESOLVE_TIMEOUT);
5955 run_loop ();
6056 ASSERT_EQ (NameResolver::SUCCESS, status ());
61- #ifdef WIN32
62- char win_hostname[64 ];
63- gethostname (win_hostname, 64 );
64- EXPECT_EQ (String (win_hostname), hostname ());
65- #else
66- EXPECT_EQ (" localhost" , hostname ());
67- #endif
57+ EXPECT_EQ (" cpp-driver.hostname." , hostname ());
6858}
6959
7060TEST_F (NameResolverUnitTest, Timeout) {
71- NameResolver::Ptr resolver (create (Address (" 127.0.0.1 " , 9042 )));
61+ NameResolver::Ptr resolver (create (Address (" 127.254.254.254 " , 9042 )));
7262
7363 // Libuv's address resolver uses the uv_work thread pool to handle resolution
7464 // asynchronously. If we starve all the threads in the uv_work thread pool
@@ -91,7 +81,7 @@ TEST_F(NameResolverUnitTest, Invalid) {
9181}
9282
9383TEST_F (NameResolverUnitTest, Cancel) {
94- NameResolver::Ptr resolver (create (Address (" 127.0.0.1 " , 9042 )));
84+ NameResolver::Ptr resolver (create (Address (" 127.254.254.254 " , 9042 )));
9585 resolver->resolve (loop (), RESOLVE_TIMEOUT);
9686 resolver->cancel ();
9787 run_loop ();
0 commit comments