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

Function waitForFileCreation

src/tests/containerizer/port_mapping_tests.cpp:439–451  ·  view source on GitHub ↗

Wait up to timeout seconds for a file to be created. If timeout is zero, then wait indefinitely. Return true if file exists. TODO(pbrett): Consider generalizing this function and moving it to a common header.

Source from the content-addressed store, hash-verified

437// TODO(pbrett): Consider generalizing this function and moving it to
438// a common header.
439static bool waitForFileCreation(
440 const string& path,
441 const Duration& duration = Seconds(60))
442{
443 Stopwatch timer;
444 timer.start();
445 while (!os::exists(path)) {
446 if ((duration > Duration::zero()) && (timer.elapsed() > duration))
447 break;
448 os::sleep(Milliseconds(50));
449 }
450 return os::exists(path);
451}
452
453
454// This test uses two containers: one listens to 'validPort' and

Callers 1

TEST_FFunction · 0.85

Calls 6

SecondsClass · 0.85
MillisecondsClass · 0.85
elapsedMethod · 0.80
startMethod · 0.65
existsFunction · 0.50
sleepFunction · 0.50

Tested by

no test coverage detected