Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server improvements #44

Merged
merged 7 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions linux/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ target_link_libraries(netremote-server-linux
netremote-server
)

set_target_properties(netremote-server-linux
PROPERTIES
OUTPUT_NAME netremote-server
)

install(
TARGETS netremote-server-linux
EXPORT netremote
Expand Down
7 changes: 5 additions & 2 deletions linux/server/Main.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

using namespace Microsoft::Net::Remote;

int
main(int argc, char* argv[])
int main(int argc, char* argv[])
{
const auto configuration = NetRemoteServerConfiguration::FromCommandLineArguments(argc, argv);

Expand All @@ -28,6 +27,10 @@ main(int argc, char* argv[])
throw std::runtime_error(what);
}
}
else
{
server.GetGrpcServer()->Wait();
}

return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct NetRemoteServerConfiguration
/**
* @brief Run the service in the background.
*/
bool RunInBackground{ true };
bool RunInBackground{ false };
};

} // namespace Microsoft::Net::Remote
Expand Down
17 changes: 15 additions & 2 deletions tests/unit/TestNetRemoteServiceClient.cxx
Original file line number Diff line number Diff line change
@@ -1,31 +1,44 @@

#include <array>
#include <chrono>
#include <cstdint>
#include <format>
#include <iostream>

#include <catch2/catch_test_macros.hpp>
#include <grpc/grpc.h>
#include <grpcpp/create_channel.h>
#include <magic_enum.hpp>
#include <microsoft/net/remote/NetRemoteService.hxx>
#include <NetRemoteService.grpc.pb.h>

using namespace std::chrono_literals;

namespace detail
{
constexpr auto RemoteServiceAddressHttp = "localhost:5047";
[[maybe_unused]] constexpr auto RemoteServiceAddressHttps = "localhost:7073";
constexpr auto RemoteServiceConnectionTimeout = 3s;
} // namespace detail

TEST_CASE("net remote service can be reached", "[basic][rpc][client][remote]")
{
using namespace Microsoft::Net::Remote::Service;

auto channel = grpc::CreateChannel(detail::RemoteServiceAddressHttp, grpc::InsecureChannelCredentials());
auto client = NetRemote::NewStub(channel);

REQUIRE(channel->WaitForConnected(std::chrono::system_clock::now() + detail::RemoteServiceConnectionTimeout));
}

TEST_CASE("WifiConfigureAccessPoint API can be called", "[basic][rpc][client][remote]")
{
using namespace Microsoft::Net::Remote;
using namespace Microsoft::Net::Remote::Service;

auto channel = grpc::CreateChannel(detail::RemoteServiceAddressHttp, grpc::InsecureChannelCredentials());
auto client = NetRemote::NewStub(channel);

SECTION("WifiConfigureAccessPoint can be called")
SECTION("Can be called")
{
for (const auto& band : magic_enum::enum_values<Microsoft::Net::Wifi::RadioBand>())
{
Expand Down
5 changes: 5 additions & 0 deletions windows/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ target_link_libraries(netremote-server-windows
netremote-server
)

set_target_properties(netremote-server-windows
PROPERTIES
OUTPUT_NAME netremote-server
)

install(
TARGETS netremote-server-windows
EXPORT netremote
Expand Down