Skip to content

Commit

Permalink
add: Add dynamic package URLs to qactl #1803
Browse files Browse the repository at this point in the history
  • Loading branch information
jmv74211 committed Sep 3, 2021
1 parent eb1a52b commit 3f51723
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from wazuh_testing.tools.time import get_current_timestamp
from wazuh_testing.qa_ctl import QACTL_LOGGER
from wazuh_testing.tools.logging import Logging
from wazuh_testing.tools.s3_package import get_s3_package_url
from wazuh_testing.qa_ctl.provisioning.wazuh_deployment.wazuh_s3_package import WazuhS3Package


class QACTLConfigGenerator:
Expand Down Expand Up @@ -85,7 +87,7 @@ def __get_all_tests_info(self):
tests_info = [
{
'test_path': 'tests/integration/test_vulnerability_detector/test_general_settings/test_general_settings_enabled.py',
'test_wazuh_min_version': '4.2.1',
'test_wazuh_min_version': '4.2.0',
'test_system': 'linux',
'test_vendor': 'ubuntu',
'test_os_version': '20.04',
Expand All @@ -95,7 +97,7 @@ def __get_all_tests_info(self):
{
'test_path': 'tests/integration/test_vulnerability_detector/test_general_settings/test_general_settings_enabled.py',
'test_wazuh_min_version': '4.2.0',
'test_system': 'windows',
'test_system': 'linux',
'test_vendor': 'centos',
'test_os_version': '8',
'test_target': 'agent',
Expand Down Expand Up @@ -221,15 +223,15 @@ def __add_instance(self, test_vendor, test_name, test_target, test_system, vm_cp
return instance

def __get_package_url(self, instance):
# target = 'manager' if 'manager' in self.config['deployment'][instance]['provider']['vagrant']['label'] \
# else 'agent'
# vagrant_box = self.config['deployment'][instance]['provider']['vagrant']['vagrant_box']
# system = QACTLConfigGenerator.BOX_INFO[vagrant_box]['system']
# architecture = 'x86_64' # Get architecture from system
target = 'manager' if 'manager' in self.config['deployment'][instance]['provider']['vagrant']['label'] \
else 'agent'
vagrant_box = self.config['deployment'][instance]['provider']['vagrant']['vagrant_box']
system = QACTLConfigGenerator.BOX_INFO[vagrant_box]['system']
architecture = WazuhS3Package.get_architecture(system)

# package_url = get_package_url('live', target, self.wazuh_version, '1', system, architecture)
pass
package_url = get_s3_package_url('live', target, self.wazuh_version, '1', system, architecture)

return package_url

def __process_deployment_data(self, tests_info):
self.config['deployment'] = {}
Expand Down Expand Up @@ -269,7 +271,7 @@ def __process_provision_data(self):
# Wazuh deployment
target = 'manager' if 'manager' in self.config['deployment'][instance]['provider']['vagrant']['label'] \
else 'agent'
s3_package_url = 'mocked_url' ## self.__get_package_url(instance)
s3_package_url = self.__get_package_url(instance)
self.config['provision']['hosts'][instance]['wazuh_deployment'] = {
'type': 'package',
'target': target,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def __init__(self, wazuh_target, installation_files_path, qa_ctl_configuration,
super().__init__(wazuh_target=wazuh_target, installation_files_path=installation_files_path,
system=system, version=version, qa_ctl_configuration=qa_ctl_configuration)

def __get_architecture(self, system):
@staticmethod
def get_architecture(system):
"""Get the needed architecture for the wazuh package
Args:
Expand Down Expand Up @@ -87,7 +88,7 @@ def download_installation_files(self, inventory_file_path, s3_package_url=None,
"""
if s3_package_url is None and self.version is not None and self.repository is not None and \
self.system is not None and self.revision is not None:
architecture = self.__get_architecture(self.system)
architecture = WazuhS3Package.get_architecture(self.system)
s3_package_url = get_s3_package_url(self.repository, self.wazuh_target, self.version,
self.revision, self.system, architecture)
else:
Expand Down
1 change: 1 addition & 0 deletions deps/wazuh_testing/wazuh_testing/scripts/qa_ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def main():

arguments = parser.parse_args()

# Generate or get the qactl configuration file
if arguments.run_test:
config_generator = QACTLConfigGenerator(arguments.run_test, arguments.version)
config_generator.run()
Expand Down

0 comments on commit 3f51723

Please sign in to comment.