mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
allow system to choose port of webfuse server
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "webfuse/tests/integration/server.hpp"
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <unistd.h>
|
||||
@@ -59,7 +60,7 @@ public:
|
||||
|
||||
|
||||
config = wf_server_config_create();
|
||||
wf_server_config_set_port(config, 8080);
|
||||
wf_server_config_set_port(config, 0);
|
||||
wf_server_config_set_mountpoint_factory(config,
|
||||
&webfuse_test_server_create_mountpoint,
|
||||
reinterpret_cast<void*>(base_dir));
|
||||
@@ -92,6 +93,14 @@ public:
|
||||
return is_shutdown_requested;
|
||||
}
|
||||
|
||||
std::string GetUrl(void) const
|
||||
{
|
||||
int const port = wf_server_get_port(server);
|
||||
std::ostringstream stream;
|
||||
stream << "wss://localhost:" << port << "/";
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
private:
|
||||
void RequestShutdown()
|
||||
{
|
||||
@@ -136,5 +145,10 @@ char const * Server::GetBaseDir(void) const
|
||||
return d->base_dir;
|
||||
}
|
||||
|
||||
std::string Server::GetUrl(void) const
|
||||
{
|
||||
return d->GetUrl();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef WF_TEST_INTEGRATION_SERVER_HPP
|
||||
#define WF_TEST_INTEGRATION_SERVER_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace webfuse_test
|
||||
{
|
||||
|
||||
@@ -12,6 +14,7 @@ public:
|
||||
void Start(void);
|
||||
void Stop(void);
|
||||
char const * GetBaseDir(void) const;
|
||||
std::string GetUrl(void) const;
|
||||
private:
|
||||
class Private;
|
||||
Private * d;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace
|
||||
void SetUp()
|
||||
{
|
||||
server = new Server();
|
||||
provider = new Provider("wss://localhost:8080/");
|
||||
provider = new Provider(server->GetUrl().c_str());
|
||||
}
|
||||
|
||||
void TearDown()
|
||||
|
||||
Reference in New Issue
Block a user