MCPcopy Create free account
hub / github.com/apache/mesos / TEST_F

Function TEST_F

3rdparty/libprocess/src/tests/socket_tests.cpp:83–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82#ifndef __WINDOWS__
83TEST_F(SocketTest, Unix)
84{
85 Try<unix::Socket> server = unix::Socket::create();
86 ASSERT_SOME(server);
87
88 Try<unix::Socket> client = unix::Socket::create();
89 ASSERT_SOME(client);
90
91 // Use a path in the temporary directory so it gets cleaned up.
92 string path = path::join(sandbox.get(), "socket");
93
94 Try<unix::Address> address = unix::Address::create(path);
95 ASSERT_SOME(address);
96
97 ASSERT_SOME(server->bind(address.get()));
98 ASSERT_SOME(server->listen(1));
99
100 Future<unix::Socket> accept = server->accept();
101
102 AWAIT_READY(connectSocket(*client, address.get()));
103 AWAIT_READY(accept);
104
105 unix::Socket socket = accept.get();
106
107 const string data = "Hello World!";
108
109 AWAIT_READY(client->send(data));
110 AWAIT_EQ(data, socket.recv(data.size()));
111
112 AWAIT_READY(socket.send(data));
113 AWAIT_EQ(data, client->recv(data.size()));
114}
115
116
117// Parameterize the tests with the type of encryption used.

Callers

nothing calls this directly

Calls 10

connectSocketFunction · 0.70
sendMethod · 0.65
createFunction · 0.50
joinFunction · 0.50
getMethod · 0.45
bindMethod · 0.45
listenMethod · 0.45
acceptMethod · 0.45
recvMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected