Skip to content

Commit

Permalink
Fix random port problem
Browse files Browse the repository at this point in the history
random port was not really random. Seed was never set so it was generating the same port.
  • Loading branch information
George Guliashvili authored and fmanco committed Dec 7, 2018
1 parent 6a64e35 commit a32ed7c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion osquery/tests/test_additional_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void TLSServerRunner::start() {
}

// Pick a port in an ephemeral range at random.
self.port_ = std::to_string(rand() % 10000 + 20000);
self.port_ = std::to_string(getUnixTime() % 10000 + 20000);

// Fork then exec a shell.
auto python_server = (fs::path(kTestDataPath) / "test_http_server.py")
Expand Down

0 comments on commit a32ed7c

Please sign in to comment.