From fcd878e9a1a3fe0ee3d5c8f7895c2095af31b225 Mon Sep 17 00:00:00 2001 From: FabiTheGuy Date: Thu, 19 Sep 2024 15:29:42 +0200 Subject: [PATCH] Outsources Connection Test + added Test for Connection to Socket without Authentication --- test/main.cpp | 8 +------- test/test_connection.hpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 test/test_connection.hpp diff --git a/test/main.cpp b/test/main.cpp index 558b442..a7b9f8b 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,12 +1,6 @@ -#include +#include "test_connection.hpp" #include -TEST(DockerConnection, PingDaemon) { - dockerxx::Docker docker; - - ASSERT_EQ(docker.ping(), "OK"); -} - int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); diff --git a/test/test_connection.hpp b/test/test_connection.hpp new file mode 100644 index 0000000..a087802 --- /dev/null +++ b/test/test_connection.hpp @@ -0,0 +1,20 @@ +#ifndef DOCKERXX_TEST_CONNECTION_HPP +#define DOCKERXX_TEST_CONNECTION_HPP + +#include +#include +#include "credential.hpp" + +TEST(Connection, LocalDaemonPing) { + dockerxx::Docker docker; + + ASSERT_EQ(docker.ping(), "OK"); +} + +TEST(Connection, RemoteDaemonPingNoAuthentication) { + dockerxx::Docker docker = dockerxx::Docker(REMOTE_DAEMON_ADDRESS); + + ASSERT_EQ(docker.ping(), "OK"); +} + +#endif /* DOCKERXX_TEST_CONNECTION_HPP */ \ No newline at end of file