Skip to content

Commit

Permalink
Deleted unattended references in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcr01 committed Aug 22, 2024
1 parent 8bbd245 commit 8f2070c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tests/install/test_unattended.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_password(username):
pass_dict={'username': 'tmp_user', 'password': 'tmp_pass'}
tmp_yaml=""

with tarfile.open("../../../unattended_installer/wazuh-install-files.tar") as configurations:
with tarfile.open("../../wazuh-install-files.tar") as configurations:
configurations.extract("wazuh-install-files/wazuh-passwords.txt")

with open("wazuh-install-files/wazuh-passwords.txt", 'r') as pass_file:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This document provides instructions on how to run unit tests for the Wazuh insta
## Usage

```
unit-tests.sh - Unit test for the Wazuh installer.
unit-tests.sh - Unit test for the Wazuh installation assistant.
```

### Synopsis
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/docker-unit-testing-tool/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM alpine:latest
RUN apk add --no-cache bash coreutils diffutils
RUN mkdir -p /tests/unattended/
RUN mkdir -p /tests/

COPY entrypoint.sh /usr/local/bin/test_file
RUN chmod +x /usr/local/bin/test_file
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/docker-unit-testing-tool/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

FILE_NAME=${1}
cd /tests/unattended
cd /tests/
if [ -f test-${FILE_NAME}.sh ]; then
bash test-${FILE_NAME}.sh
else
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/suites/test-dashboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ test-07-dashboard_configure-dist-one-kibana-node-one-elastic-node() {

test-07-dashboard_configure-dist-one-kibana-node-one-elastic-node-assert() {
dashboard_copyCertificates
installCommon_getConfig dashboard/dashboard_unattended_distributed.yml /etc/wazuh-dashboard/opensearch_dashboards.yml
installCommon_getConfig dashboard/dashboard_assistant_distributed.yml /etc/wazuh-dashboard/opensearch_dashboards.yml
}

test-08-dashboard_configure-dist-two-kibana-nodes-two-elastic-nodes() {
Expand All @@ -127,7 +127,7 @@ test-08-dashboard_configure-dist-two-kibana-nodes-two-elastic-nodes() {

test-08-dashboard_configure-dist-two-kibana-nodes-two-elastic-nodes-assert() {
dashboard_copyCertificates
installCommon_getConfig dashboard/dashboard_unattended_distributed.yml /etc/wazuh-dashboard/opensearch_dashboards.yml
installCommon_getConfig dashboard/dashboard_assistant_distributed.yml /etc/wazuh-dashboard/opensearch_dashboards.yml
}

test-09-dashboard_configure-AIO() {
Expand All @@ -142,7 +142,7 @@ test-09-dashboard_configure-AIO() {

test-09-dashboard_configure-AIO-assert() {
dashboard_copyCertificates
installCommon_getConfig dashboard/dashboard_unattended.yml /etc/wazuh-dashboard/opensearch_dashboards.yml
installCommon_getConfig dashboard/dashboard_assistant.yml /etc/wazuh-dashboard/opensearch_dashboards.yml
}

function load-dashboard_initialize() {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/suites/test-filebeat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ test-11-filebeat_configure-AIO-no-previous-variables() {
test-11-filebeat_configure-AIO-no-previous-variables-assert() {
curl -so /etc/filebeat/wazuh-template.json --max-time 300
chmod go+r /etc/filebeat/wazuh-template.json
installCommon_getConfig filebeat/filebeat_unattended.yml /etc/filebeat/filebeat.yml
installCommon_getConfig filebeat/filebeat_assistant.yml /etc/filebeat/filebeat.yml
mkdir /etc/filebeat/certs
filebeat_copyCertificates
filebeat keystore create
Expand All @@ -210,7 +210,7 @@ test-12-filebeat_configure-AIO() {
test-12-filebeat_configure-AIO-assert() {
curl -so /etc/filebeat/wazuh-template.json https://raw.githubusercontent.com/wazuh/wazuh/4.3/extensions/elasticsearch/7.x/wazuh-template.json --max-time 300
chmod go+r /etc/filebeat/wazuh-template.json
installCommon_getConfig filebeat/filebeat_unattended.yml /etc/filebeat/filebeat.yml
installCommon_getConfig filebeat/filebeat_assistant.yml /etc/filebeat/filebeat.yml
mkdir /etc/filebeat/certs
filebeat_copyCertificates
filebeat keystore create
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/suites/test-indexer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ test-07-indexer_configure-dist-one-elastic-node-assert() {
sed -i "s/-Xms1g/-Xms1g/" /etc/wazuh-indexer/jvm.options
sed -i "s/-Xmx1g/-Xmx1g/" /etc/wazuh-indexer/jvm.options

installCommon_getConfig indexer/indexer_unattended_distributed.yml /etc/wazuh-indexer/opensearch.yml
installCommon_getConfig indexer/indexer_assistant_distributed.yml /etc/wazuh-indexer/opensearch.yml

indexer_copyCertificates
}
Expand All @@ -135,7 +135,7 @@ test-08-indexer_configure-dist-two-elastic-nodes-assert() {
sed -i "s/-Xms1g/-Xms1g/" /etc/wazuh-indexer/jvm.options
sed -i "s/-Xmx1g/-Xmx1g/" /etc/wazuh-indexer/jvm.options

installCommon_getConfig indexer/indexer_unattended_distributed.yml /etc/wazuh-indexer/opensearch.yml
installCommon_getConfig indexer/indexer_assistant_distributed.yml /etc/wazuh-indexer/opensearch.yml

indexer_copyCertificates
}
Expand All @@ -156,7 +156,7 @@ test-09-indexer_configure-AIO-assert() {
sed -i 's/-Xms1g/-Xms1g/' /etc/wazuh-indexer/jvm.options
sed -i 's/-Xmx1g/-Xmx1g/' /etc/wazuh-indexer/jvm.options

installCommon_getConfig indexer/indexer_unattended_distributed.yml /etc/wazuh-indexer/opensearch.yml
installCommon_getConfig indexer/indexer_assistant_distributed.yml /etc/wazuh-indexer/opensearch.yml

indexer_copyCertificates
}
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install_dir="install_functions"
cert_dir="cert_tool"
passwords_dir="passwords_tool"
common_dir="common_functions"
IMAGE_NAME="unattended-installer-unit-tests-launcher"
IMAGE_NAME="assistant-unit-tests-launcher"
SHARED_VOLUME="$(pwd -P)/tmp/"

function common_logger() {
Expand Down Expand Up @@ -72,19 +72,19 @@ function testFile() {

eval "cp suites/test-${1}.sh ${SHARED_VOLUME}"
if printf '%s\n' "${install_files[@]}" | grep -F -x -q "${1}" ; then
eval "cp ../../../unattended_installer/${install_dir}/${1}.sh ${SHARED_VOLUME} ${debug}"
eval "cp ../../${install_dir}/${1}.sh ${SHARED_VOLUME} ${debug}"
elif printf '%s\n' "${passwords_files[@]}" | grep -F -x -q "${1}"; then
eval "cp ../../../unattended_installer/${passwords_dir}/${1}.sh ${SHARED_VOLUME} ${debug}"
eval "cp ../../${passwords_dir}/${1}.sh ${SHARED_VOLUME} ${debug}"
elif printf '%s\n' "${cert_files[@]}" | grep -F -x -q "${1}"; then
eval "cp ../../../unattended_installer/${cert_dir}/${1}.sh ${SHARED_VOLUME} ${debug}"
eval "cp ../../${cert_dir}/${1}.sh ${SHARED_VOLUME} ${debug}"
elif printf '%s\n' "${common_files[@]}" | grep -F -x -q "${1}"; then
eval "cp ../../../unattended_installer/${common_dir}/${1}.sh ${SHARED_VOLUME} ${debug}"
eval "cp ../../${common_dir}/${1}.sh ${SHARED_VOLUME} ${debug}"
else
common_logger -e "File ${1}.sh could not be found."
return
fi

eval "docker run -t --rm --volume ${SHARED_VOLUME}:/tests/unattended/ --env TERM=xterm-256color ${IMAGE_NAME} ${1} | tee -a ${logfile}"
eval "docker run -t --rm --volume ${SHARED_VOLUME}:/tests/ --env TERM=xterm-256color ${IMAGE_NAME} ${1} | tee -a ${logfile}"
if [ "$?" != 0 ]; then
common_logger -e "Docker encountered some error running the unit tests for ${1}.sh"
else
Expand Down

0 comments on commit 8f2070c

Please sign in to comment.