Merge "Fix dns resolution for nginx test"
This commit is contained in:
@@ -2,7 +2,6 @@ import ipaddress
|
||||
import socket
|
||||
from typing import Optional
|
||||
|
||||
from config.configuration_manager import ConfigurationManager
|
||||
from framework.logging.automation_logger import get_logger
|
||||
from keywords.base_keyword import BaseKeyword
|
||||
|
||||
@@ -156,18 +155,16 @@ class IPAddressKeywords(BaseKeyword):
|
||||
|
||||
def check_dnsname_resolution(self, dns_name: str) -> bool:
|
||||
"""
|
||||
Method to verify the dnsname resolution of the lab
|
||||
Method to verify the DNS name resolution.
|
||||
|
||||
Args:
|
||||
dns_name (str): a supposed valid dns name.
|
||||
dns_name (str): DNS name to resolve.
|
||||
|
||||
Returns:
|
||||
bool: True if the DNS name resolves to an IP address, False otherwise.
|
||||
"""
|
||||
family = socket.AF_INET
|
||||
lab_config = ConfigurationManager.get_lab_config()
|
||||
oam_fip = lab_config.get_floating_ip()
|
||||
if self.check_ip_version(oam_fip) == "IPv6":
|
||||
if self.check_ip_version(self.ip) == "IPv6":
|
||||
family = socket.AF_INET6
|
||||
try:
|
||||
socket.getaddrinfo(dns_name, None, family)
|
||||
|
||||
@@ -44,18 +44,20 @@ def test_app_using_nginx_controller(request):
|
||||
security_config = ConfigurationManager.get_security_config()
|
||||
|
||||
oam_ip = lab_config.get_floating_ip()
|
||||
dns_name = security_config.get_domain_name()
|
||||
lab_name = lab_config.get_lab_name()
|
||||
domain_name = security_config.get_domain_name()
|
||||
full_dns_name = f"{lab_name}.{domain_name}"
|
||||
stepca_url = security_config.get_stepca_server_url()
|
||||
expected_issuer = security_config.get_stepca_server_issuer()
|
||||
|
||||
dns_resolution_status = IPAddressKeywords(oam_ip).check_dnsname_resolution(dns_name=dns_name)
|
||||
validate_equals(dns_resolution_status, True, "Verify the dns name resolution")
|
||||
dns_resolution_status = IPAddressKeywords(oam_ip).check_dnsname_resolution(full_dns_name)
|
||||
get_logger().log_info(f"DNS resolution status for {full_dns_name}: {dns_resolution_status}")
|
||||
|
||||
# Test configuration from security config
|
||||
stepca_issuer = security_config.get_nginx_external_ca_stepca_issuer()
|
||||
pod_name = security_config.get_nginx_external_ca_pod_name()
|
||||
cert = security_config.get_nginx_external_ca_cert()
|
||||
base_url = f"https://{dns_name}/"
|
||||
base_url = f"https://{full_dns_name}/"
|
||||
deploy_app_file_name = security_config.get_nginx_external_ca_deploy_app_file_name()
|
||||
global_policy_file_name = security_config.get_nginx_external_ca_global_policy_file_name()
|
||||
kuard_file_name = security_config.get_nginx_external_ca_kuard_file_name()
|
||||
@@ -99,7 +101,7 @@ def test_app_using_nginx_controller(request):
|
||||
# Generate and apply nginx ingress configuration
|
||||
get_logger().log_info("Generating and applying nginx ingress configuration")
|
||||
template_file = get_stx_resource_path(f"resources/cloud_platform/security/cert_manager/{kuard_file_name}")
|
||||
replacement_dictionary = {"dns_name": dns_name}
|
||||
replacement_dictionary = {"dns_name": full_dns_name}
|
||||
nginx_yaml = yaml_keywords.generate_yaml_file_from_template(template_file, replacement_dictionary, kuard_file_name, "/home/sysadmin")
|
||||
apply_keywords.apply_from_yaml(nginx_yaml)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user