From 55ae13e45c9975e3dd20f42ad58bd8b214b22724 Mon Sep 17 00:00:00 2001 From: eleonore12345 Date: Tue, 13 Aug 2024 17:54:29 +0200 Subject: [PATCH] debut test d'integration, debut module nginx --- src/DockerModule.h | 2 +- src/Modules.h | 9 ++- test/IntegrationTests/main.cpp | 77 -------------------- testenv/services/test.sh8s.sh/deploy.sh | 4 +- testenv/services/test.sh8s.sh/deploy_user.sh | 5 +- 5 files changed, 15 insertions(+), 82 deletions(-) delete mode 100644 test/IntegrationTests/main.cpp diff --git a/src/DockerModule.h b/src/DockerModule.h index ccd6e3d..ed1ab12 100644 --- a/src/DockerModule.h +++ b/src/DockerModule.h @@ -10,7 +10,7 @@ class DockerModule : public Module { public: - DockerModule();//inline + DockerModule(); ~DockerModule(){} //inline int Prepare (); int Deploy (string serviceUsername); diff --git a/src/Modules.h b/src/Modules.h index 67c7176..a98abdc 100644 --- a/src/Modules.h +++ b/src/Modules.h @@ -2,8 +2,15 @@ #include #include "DockerModule.h" #include "BashModule.h" +#include "NginxModule.h" +#include "WireguardModule.h" +#include "EncryptionModule.h" using namespace std; DockerModule dockerModule=DockerModule(); BashModule bashModule=BashModule(); -vector modules={&bashModule}; //&dockerModule \ No newline at end of file +NginxModule nginxModule=NginxModule(); +WireguardModule wireguardModule=WireguardModule(); +EncryptionModule encryptionModule=EncryptionModule(); + +vector modules={&bashModule,&nginxModule,&wireguardModule, &encryptionModule}; //&dockerModule \ No newline at end of file diff --git a/test/IntegrationTests/main.cpp b/test/IntegrationTests/main.cpp deleted file mode 100644 index 8710026..0000000 --- a/test/IntegrationTests/main.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// deployer IntegrationTests main -// Copyright (C) 2024 Jean-Cloud -// GNU General Public License v3 - -#include -#include "BashManager.h" - -using namespace std; - -void Help() -{ - cout << "blabla" << endl; -} - -//tests -void environmentTest() -{ - cout << "Test of the environment setup." << endl; -} - -void bashTest() -{ - cout << "Test of BashModule" << endl; -} - -void dockerTest() -{ - cout << "Test of DockerModule" << endl; -} - -void nginxTest() -{ - cout << "Test of Nginx module" << endl; -} - -void wireguardTest() -{ - cout << "Test of WireguardModule" << endl; -} - -void encryptionTest() -{ - cout << "Test of EncryptionModule" << endl; -} - -int main(int argc, char **argv) -{ - if(argc!=2){ - cerr << "Invalid number of arguments." << endl; - } else{ - BashManager::Execute("./deployer deploy all"); - string action=argv[1]; - if (action=="environment"){ - environmentTest(); - } else if (action=="bash"){ - bashTest(); - } else if (action=="docker"){ - dockerTest(); - } else if (action=="nginx"){ - nginxTest(); - } else if (action=="wireguard"){ - wireguardTest(); - } else if (action=="encryption"){ - encryptionTest(); - } else if (action=="all"){ - environmentTest(); - bashTest(); - dockerTest(); - nginxTest(); - wireguardTest(); - encryptionTest(); - } else { - cerr << "Unknown argument." << endl; - Help(); - } - } -} \ No newline at end of file diff --git a/testenv/services/test.sh8s.sh/deploy.sh b/testenv/services/test.sh8s.sh/deploy.sh index 4f48e5e..563eaa0 100755 --- a/testenv/services/test.sh8s.sh/deploy.sh +++ b/testenv/services/test.sh8s.sh/deploy.sh @@ -1 +1,3 @@ -touch done +#!/bin/bash +touch deployResult +echo $(whoami) >> deployResult diff --git a/testenv/services/test.sh8s.sh/deploy_user.sh b/testenv/services/test.sh8s.sh/deploy_user.sh index baddc29..192a94d 100755 --- a/testenv/services/test.sh8s.sh/deploy_user.sh +++ b/testenv/services/test.sh8s.sh/deploy_user.sh @@ -1,4 +1,5 @@ #!/bin/bash -set -euo pipefail -#git_update.sh -r -d "$HTTP_DIR" "$GIT_SOURCE_REPO" +touch $http_dir/deployAsResult +echo $(whoami) >> $http_dir/deployResult +