def load_test_data(): # Update config ini files at runtime # This can be used to update ini files with sensitive data such as passwords an IP addresses my_data_file = os.environ.get( 'AF_RESOURCES_PATH' ) + '/automation_test_packs/data_sensitive_vars.properties' af_support_tools.set_config_file_property_by_data_file(my_data_file) # Set config ini file name # These can be set inside the individual tests and do not need to be made global global config_file config_file = 'automation_test_packs/selenium_config.ini' # Set Vars # These can be read inside the individual tests and do not need to be made global global my_username my_username = af_support_tools.get_config_file_property( config_file=config_file, heading='data_sensitive_vars', property='username') global my_password my_password = af_support_tools.get_config_file_property( config_file=config_file, heading='data_sensitive_vars', property='password')
def test_sample_selenium(): """ This sample test is designed to demonstrate a simple selenium test. This test also demonstrate a data driven test by reading properties from a configuration file. """ # Get data from config file my_url = af_support_tools.get_config_file_property(config_file=config_file, heading='google', property='url') my_title = af_support_tools.get_config_file_property( config_file=config_file, heading='google', property='title') # Open selenium webdriver object s_driver = selenium.webdriver.Firefox() s_driver.get(my_url) # Run selenium test try: assert my_title.lower() in s_driver.title.lower( ), '\'' + my_title.lower( ) + '\' not found within ' + '\'' + s_driver.title.lower() + '\'' except: s_driver.close() print('\'' + my_title.lower() + '\' not found within ' + '\'' + s_driver.title.lower() + '\'') raise print('\'' + my_title.lower() + '\' found within ' + '\'' + s_driver.title.lower() + '\'') # Close selenium webdriver object s_driver.close()
def load_test_data(): # Update config ini files at runtime my_data_file = os.environ.get('AF_RESOURCES_PATH') + '/continuous-integration-deploy-suite/symphony-sds.properties' af_support_tools.set_config_file_property_by_data_file(my_data_file) # Set config ini file name global env_file env_file = 'env.ini' # Set Vars global payload_file payload_file = 'continuous-integration-deploy-suite/symphony-sds.ini' global payload_header payload_header = 'payload' global payload_property_amqp payload_property_amqp = 'amqp_payload' global ipaddress ipaddress = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') global cli_username cli_username = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='username') global cli_password cli_password = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='password') global consulHost consulHost = 'consul.cpsd.dell'
def load_test_data(): import cpsd global cpsd # Get the typically used passwords global setup_config_file setup_config_file = 'continuous-integration-deploy-suite/setup_config.ini' global setup_config_header setup_config_header = 'config_details' global rackHD_password rackHD_password = af_support_tools.get_config_file_property( config_file=setup_config_file, heading=setup_config_header, property='rackhd_password') global rtp_password rtp_password = af_support_tools.get_config_file_property( config_file=setup_config_file, heading=setup_config_header, property='vcenter_password_rtp') global fra_password fra_password = af_support_tools.get_config_file_property( config_file=setup_config_file, heading=setup_config_header, property='vcenter_password_fra')
def container_verify(container, attrib, pos): """ Description : This method verifies if the container name is up or not. Parameters : 1. container - Name of the container (STRING) 2. expected - expected output to be obtained from container_verify function(STRING). 3. pos - position of the string to be extracted from the formatted 'docker ps' command(STRING) Returns : output - "Up\n" or "Down\n" string coming from 'docker ps' command(STRING). """ print('Getting Values Specified Container') ipaddress = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') username = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='username') password = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='password') cmd = 'docker ps -f name=' + str(container) + ' --format "{{.' + str( attrib) + '}}" | awk \'{print $' + str(pos) + '}\'' output = af_support_tools.send_ssh_command(host=ipaddress, username=username, password=password, command=cmd, return_output=True).strip() return output
def load_test_data(): # Set config ini file name global env_file env_file = 'env.ini' # Set Vars global ipaddress ipaddress = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') global username username = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='username') global password password = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='password')
class props(object): # Set env.ini file name env_file = 'env.ini' # Set CPSD common global vars # Base OS base_hostname = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='hostname') base_username = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='username') base_password = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='password')
def setup(): parameters = {} env_file = 'env.ini' ipaddress = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') cli_user = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='username') cli_password = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='password') parameters['IP'] = ipaddress parameters['cli_user'] = cli_user parameters['cli_password'] = cli_password return parameters
def test_db(query, dbname): """ Title: sds DB test Description: This test verify DB connection for SDS Params: query Returns: db Response """ readFromCommand = query writetofilecmd = "echo \"" + readFromCommand + "\" > /tmp/sqlRead.txt" writetodockerfilecommand = 'docker cp /tmp/sqlRead.txt postgres:/tmp/sqlRead.txt' execSQLCommand = "docker exec -i postgres sh -c \'su - postgres sh -c \"psql \\\"dbname=" + dbname + " options=--search_path=public\\\" -t -f /tmp/sqlRead.txt\"\'" # Set config ini file name env_file = 'env.ini' # Test VM Details ipaddress = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') cli_username = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='username') cli_password = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='password') try: af_support_tools.send_ssh_command(host=ipaddress, username=cli_username, password=cli_password, command=writetofilecmd, return_output=True) af_support_tools.send_ssh_command(host=ipaddress, username=cli_username, password=cli_password, command=writetodockerfilecommand, return_output=True) result = af_support_tools.send_ssh_command(host=ipaddress, username=cli_username, password=cli_password, command=execSQLCommand, return_output=True) print(result) return result except Exception as err: # Return code error print(err, '\n') raise Exception(err)
def load_test_data(): # Update config ini files at runtime my_data_file = os.environ.get( 'AF_RESOURCES_PATH' ) + '/continuous-integration-deploy-suite/symphony-sds.properties' af_support_tools.set_config_file_property_by_data_file(my_data_file) # Set config ini file name global env_file env_file = 'env.ini' # Set Vars # Payloads from symphony-sds.ini:- location: continuous-integration-deploy-suite/symphony-sds.ini global payload_file payload_file = 'continuous-integration-deploy-suite/symphony-sds.ini' global payload_heading payload_heading = 'credential_tests' global payload_property_add payload_property_add = 'cs_cred_addition' global payload_property_req payload_property_req = 'cs_cred_request' global payload_property_neg1 payload_property_neg1 = 'cs_no_comp_addition' global payload_property_neg2 payload_property_neg2 = 'ca_dup_ep_addition' global payload_property_neg3 payload_property_neg3 = 'cs_invalid_json' global payload_property_neg4 payload_property_neg4 = 'cs_invalid_msg_prop' global payload_property_neg5 payload_property_neg5 = 'cs_req_invalid_uuid' global ipaddress ipaddress = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') global cli_username cli_username = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='username') global cli_password cli_password = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='password') global rmq_username rmq_username = '******' global rmq_password rmq_password = '******' global port port = 5672
def test_api_addsystem(): err=[] api_url = 'http://' + ipaddress + ':5500/v1/amqp/system-definition/' the_payload = af_support_tools.get_config_file_property(config_file=payload_file, heading= payload_header, property= payload_property_amqp ) sysadd = json.loads(the_payload) time.sleep(10) header = {'Content-Type': 'application/json', 'Accept': 'application/json'} r = requests.post(api_url, headers = header, data=the_payload) resp = json.loads(r.text) ## Validating contents of json file and message returned from Rest API if resp == None: err.append("Error---System not added successfully") assert not err if sysadd["body"]["convergedSystem"]["identity"]["serialNumber"] != resp["body"]["convergedSystem"]["identity"]["serialNumber"]: err.append("Error---Correct Serial number not returned") assert not err if (sysadd["body"]["convergedSystem"]["components"][0] != resp["body"]["convergedSystem"]["components"][0]and sysadd["body"]["convergedSystem"]["components"][1] != resp["body"]["convergedSystem"]["components"][1]and sysadd["body"]["convergedSystem"]["components"][1] != resp["body"]["convergedSystem"]["components"][2]and sysadd["body"]["convergedSystem"]["components"][3] != resp["body"]["convergedSystem"]["components"][3]): err.append("Error---All Components are not added successfully") assert not err
def load_test_data(): global path path = "/home/autouser/PycharmProjects/auto-framework/test_suites/continuous-integration-deploy-suite/rcm-fitness-ci-cd/restLevelTests/rcmInventory/" ensurePathExists(path) purgeOldOutput(path, "rcmDef") global ssl_options ssl_options = { "ca_certs": "/etc/rabbitmq/certs/testca/cacert.pem", "certfile": "/etc/rabbitmq/certs/certs/client/cert.pem", "keyfile": "/etc/rabbitmq/certs/certs/client/key.pem", "cert_reqs": "ssl.CERT_REQUIRED", "ssl_version": "ssl.PROTOCOL_TLSv1_2" } # Set config ini file name global env_file env_file = 'env.ini' global host host = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') ensurePathExists(path) purgeOldOutput(path, "rcmInventoryVer")
def test_sample_read_config_file_fail(): """ This sample test is designed to demonstrate a data driven test by reading properties from a configuration file. While demonstrating the list compare function a mocked API call is used to provide sample json data. This test is designed to fail. """ print() print('Username: %s' % my_username) print('Password: %s' % my_password) print() # Get attributes widget_attributes_list = af_support_tools.get_config_file_property( config_file=config_file, heading='widget_class_2', property='attributes') widget_attributes_list = widget_attributes_list.split(',') # Mock call to API to retrieve data mock_data_attributes_list = [ 'description', 'model_number', 'name', 'serial_number', 'uid', 'class_1_only_attribute' ] # Sample 'assert' pass_flag = af_support_tools.list_compare_all_list_one_items_found_in_list_two( mock_data_attributes_list, widget_attributes_list) assert pass_flag == True
def getNumItems(): orignumSystems = 0 orignumGroups = 0 orignumSubSystems = 0 orignumComponents = 0 # Get the payload data from the config symphony-sds.ini file. originalSys = af_support_tools.get_config_file_property(config_file=payload_file, heading=payload_header, property=payload_property_sys) originalSys_json = json.loads(originalSys, encoding='utf-8') orignumSystems += 1 for x in originalSys_json['convergedSystem']['groups']: orignumGroups += 1 for x in originalSys_json['convergedSystem']['subSystems']: orignumSubSystems += 1 for x in originalSys_json['convergedSystem']['components']: orignumComponents += 1 totalNum = orignumSystems + orignumGroups + orignumSubSystems + orignumComponents return totalNum
def verifyHalContent(): print('Verifying content of the HAL response message...') # Get the payload data from the config symphony-sds.ini file. originalSys = af_support_tools.get_config_file_property(config_file=payload_file, heading=payload_header, property=payload_property_sys) originalSys_json = json.loads(originalSys, encoding='utf-8') orignumComponents = 0 for x in originalSys_json['convergedSystem']['components']: orignumComponents += 1 # We are deliberately not removing the message from the queue as it will be consumed in a later test. ref: Joe return_message = af_support_tools.rmq_consume_message(host=ipaddress, port=port, rmq_username=rmq_username, rmq_password=rmq_password, queue='test.hal.orchestrator.response', remove_message=False) return_json = json.loads(return_message, encoding='utf-8') returnnumDevices = 0 for x in return_json['devices']: returnnumDevices += 1 print('Original: ',orignumComponents, ' Returned: ', returnnumDevices) if orignumComponents != returnnumDevices: print('ERROR: Not all components have returned values. Possible h/w or credential issue.') assert orignumComponents == returnnumDevices print('Step 5e: All devices have been returned\n')
def add_node_url(dne_paqx_base_url): my_data = {'dne_base_url': '', 'add_node_url': '', 'add_node_resp': '', 'preprocess_workflow_id': '', 'workflow_id': '', 'uuid': ''} # Get vars from env ini file env_file = 'env.ini' host = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') endpoint = '/nodes' url = dne_paqx_base_url + endpoint my_data['add_node_url'] = url
def getSystemDefinitionListMessage(rabbitMq): rabbitMq.bind_queue_with_key(queue='test.system.list.found', exchange='exchange.dell.cpsd.syds.system.definition.response', routing_key='#') the_payload = af_support_tools.get_config_file_property(config_file=payload_file, heading='payload', property=payload_property_req)
def load_test_data(): import cpsd global cpsd # Set config ini file name global env_file env_file = 'env.ini' # Test VM Details global ipaddress ipaddress = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') global cli_username cli_username = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='username') global cli_password cli_password = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='password') # RMQ Details global rabbitmq_hostname ,port port = af_support_tools.get_config_file_property(config_file=env_file, heading='RabbitMQ', property='ssl_port') rabbitmq_hostname = "amqp.cpsd.dell" #Consul Details global consul_hostname consul_hostname = "consul.cpsd.dell" # Update setup_config.ini file at runtime my_data_file = os.environ.get('AF_RESOURCES_PATH') + '/continuous-integration-deploy-suite/setup_config.properties' af_support_tools.set_config_file_property_by_data_file(my_data_file) # vCenter VM IP & Creds details global setup_config_file setup_config_file = 'continuous-integration-deploy-suite/setup_config.ini' global setup_config_header setup_config_header = 'config_details' global vcenter_IP vcenter_IP = af_support_tools.get_config_file_property(config_file=setup_config_file, heading=setup_config_header, property='vcenter_ipaddress') global vcenter_username vcenter_username = af_support_tools.get_config_file_property(config_file=setup_config_file, heading=setup_config_header, property='vcenter_username') global vcenter_password vcenter_password = af_support_tools.get_config_file_property(config_file=setup_config_file, heading=setup_config_header, property='vcenter_password') global rpm_name rpm_name = "dell-cpsd-hal-vcenter-adapter" global service_name service_name = 'dell-cpsd-hal-vcenter-adapter' global vcenter_port vcenter_port = '443'
def CS_CredReq_invalidMsgProp(): print( "Running test No. 8 - Request Credentials with Invalid message properties..." ) clearLogFiles() the_payload = af_support_tools.get_config_file_property( config_file=payload_file, heading=payload_heading, property=payload_property_neg4) publishMessageCredReq(the_payload) return_message = af_support_tools.rmq_consume_message( host=ipaddress, port=port, rmq_username=rmq_username, rmq_password=rmq_password, queue='test.component.credential.request') validJson(return_message) published_json = json.loads(the_payload, encoding='utf-8') return_json = json.loads(return_message, encoding='utf-8') # Checking the "Message received" matches the "Message published" assert published_json == return_json print('Published Message Received: PASSED') # There will be no response message. We can verify the "test.component.credential.response" queue is empty. q_len = af_support_tools.rmq_message_count( host=ipaddress, port=port, rmq_username=rmq_username, rmq_password=rmq_password, queue='test.component.credential.response') assert q_len == 0 sendCommand = 'docker ps | grep credentials-service | awk \'{system("docker exec -i "$1" cat /opt/dell/cpsd/credentials/logs/credentials-service-error.log") }\'' error1 = "VAMQP2004E Message property [correlationId] is empty.]" error2 = "VAMQP1008E AMQP error" error3 = "(attempt 3)" my_return_text = af_support_tools.send_ssh_command(host=ipaddress, username=cli_username, password=cli_password, command=sendCommand, return_output=True) time.sleep(2) assert error1 in my_return_text assert error2 in my_return_text assert error3 not in my_return_text print('Test 8 of 9: Invalid Message Format: TEST PASSED\n') print('************************************************') time.sleep(1)
def load_test_data(): # Set config ini file name global config_file config_file = 'continuous-integration-deploy-suite/identity_service.ini' global identifyelement identifyelement = af_support_tools.get_config_file_property(config_file=config_file, heading='identity_service_payloads', property='identifyelement')
def load_test_data(): # Update config ini files at runtime my_data_file = os.environ.get( 'AF_RESOURCES_PATH' ) + '/continuous-integration-deploy-suite/symphony-sds.properties' af_support_tools.set_config_file_property_by_data_file(my_data_file) # Set config ini file name global env_file env_file = 'env.ini' # Set Vars global payload_file payload_file = 'continuous-integration-deploy-suite/symphony-sds.ini' global payload_header payload_header = 'payload' global payload_property_sys payload_property_sys = 'sys_payload' global payload_property_req payload_property_req = 'sys_request_payload' global payload_property_req_config payload_property_req_config = 'sys_request_payload_with_config' global payload_property_hal payload_property_hal = 'ccv_payload' global ipaddress ipaddress = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') global cli_username cli_username = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='username') global cli_password cli_password = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='password') global rmq_username rmq_username = '******' global rmq_password rmq_password = '******' global port port = 5672
def load_test_data(): global env_file env_file = 'env.ini' global host host = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') global path path = '/home/autouser/PycharmProjects/auto-framework/test_suites/continuousIntegration/c_systemDefinition/' global ensurePathExists ensurePathExists(path) global purgeOldOutput purgeOldOutput(path, "rcm")
def dne_paqx_base_url(): my_data = {'dne_base_url': '', 'add_node_url': '', 'add_node_resp': '', 'preprocess_workflow_id': '', 'workflow_id': '', 'uuid': ''} # Get vars from env ini file env_file = 'env.ini' host = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') protocol = 'http://' port = '8071' endpoint = '/dne' url = protocol + host + ':' + port + endpoint my_data['dne_base_url'] = url return url
def load_test_data(): import cpsd global cpsd # Set config ini file name global env_file env_file = 'env.ini' # Test VM Details global ipaddress ipaddress = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') global cli_username cli_username = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='username') global cli_password cli_password = af_support_tools.get_config_file_property( config_file=env_file, heading='Base_OS', property='password')
def verifySystemExists(): # Check that the system exists print('\n*******************************************************') print('Step 4. Verifying System has been configured...') # Get the payload data from the config symphony-sds.ini file. the_payload = af_support_tools.get_config_file_property(config_file=payload_file, heading=payload_header, property=payload_property_req) time.sleep(1) af_support_tools.rmq_publish_message(host=ipaddress, port=port, rmq_username=rmq_username, rmq_password=rmq_password, exchange='exchange.dell.cpsd.syds.system.definition.request', routing_key='dell.cpsd.syds.converged.system.list.requested', headers={'__TypeId__': 'com.dell.cpsd.syds.converged.system.list.requested'}, payload=the_payload, payload_type='json') waitForMsg('test.system.list.request') return_message = af_support_tools.rmq_consume_message(host=ipaddress, port=port, rmq_username=rmq_username, rmq_password=rmq_password, queue='test.system.list.request') published_json = json.loads(the_payload, encoding='utf-8') return_json = json.loads(return_message, encoding='utf-8') # Checking the "Message received" matches the "Message published" assert published_json == return_json print('\nTEST: Published Message Received: PASSED') # We need to wait until the queue gets the response message waitForMsg('test.system.list.found') return_message = af_support_tools.rmq_consume_message(host=ipaddress, port=port, rmq_username=rmq_username, rmq_password=rmq_password, queue='test.system.list.found') return_json = json.loads(return_message, encoding='utf-8') # Here we verify that a system is returned. Cannot be overly specific checking parameters as values will vary. assert return_json['messageProperties']['correlationId'] assert return_json['messageProperties']['replyTo'] assert return_json['messageProperties']['timestamp'] assert return_json['convergedSystems'] assert return_json['convergedSystems'][0]['uuid'] assert not return_json['convergedSystems'][0]['groups'] assert not return_json['convergedSystems'][0]['endpoints'] assert not return_json['convergedSystems'][0]['subSystems'] assert not return_json['convergedSystems'][0]['components'] my_systemUuid = return_json['convergedSystems'][0]['uuid'] print('\nTEST: System Exists - System UUID: ', my_systemUuid, ': PASSED\n') time.sleep(1)
def registerRackHD(): urldefine = 'http://' + host + ':5500/v1/amqp/' headers = {'Content-type': 'application/json', 'Accept': 'application/json'} the_payload = af_support_tools.get_config_file_property(config_file=payload_file, heading=payload_header, property=payload_rackHD) requests.post(urldefine, data=the_payload, headers=headers) verifyConsulUpdate("rackhd")
def test_SystemAdditionRequested(): q_len = 0 timeout = 0 cleanupSDS() bindSDSQueus() # Get the payload data from the config symphony-sds.ini file. the_payload = af_support_tools.get_config_file_property(config_file=payload_file, heading=payload_header, property=payload_property_sys) urldefine = 'http://' + host + ':5500/v1/amqp/' headers = {'Content-type': 'application/json', 'Accept': 'application/json'} requests.post(urldefine, data=the_payload, headers=headers) time.sleep(30) while q_len < 1: time.sleep(1) timeout += 1 q_len = af_support_tools.rmq_message_count(host=hostTLS, port=portTLS, ssl_enabled=True, queue='testSystemListRequest') print(q_len) if timeout > 30: print('ERROR: System list Request Message took to long to return. Something is wrong') cleanupSDS() break return_message = af_support_tools.rmq_consume_message(host=hostTLS, port=portTLS, ssl_enabled=True, queue='testSystemListRequest') return_json = json.loads(return_message) assert return_json['messageProperties'] assert return_json['convergedSystem']['groups'] assert return_json['convergedSystem']['definition'] assert return_json['convergedSystem']['components'] assert return_json['convergedSystem']['endpoints'] # Call the function to verify the generated credentials.addition.requested message is correct. time.sleep(60) verifyCSmessage() mess_count = af_support_tools.rmq_message_count(host=hostTLS, port=portTLS, ssl_enabled=True, queue='testSystemDefinitionEvent') assert mess_count >= 2, "Unexpected number of components defined." # Call the function to verify the system exists. This is not a necessary step but it will return the system UUID. verify_SystemExists() #verifyConsulUpdate("rcm-fitness-paqx", "rcm-fitness-api") cleanupSDS()
def CS_CredReq_invalidJson(): print("Running test No. 7 - Invalid json file...") clearLogFiles() print('check log file') time.sleep(30) the_payload = af_support_tools.get_config_file_property( config_file=payload_file, heading=payload_heading, property=payload_property_neg3) publishMessageCredReq(the_payload) return_message = af_support_tools.rmq_consume_message( host=ipaddress, port=port, rmq_username=rmq_username, rmq_password=rmq_password, queue='test.component.credential.request') try: return_json = json.loads(return_message, encoding='utf-8') i_am_json = True except Exception: i_am_json = False assert i_am_json == False if i_am_json == False: print('Verified json is invalid') sendCommand = 'docker ps | grep credentials-service | awk \'{system("docker exec -i "$1" cat /opt/dell/cpsd/credentials/logs/credentials-service-error.log") }\'' error1 = "VAMQP1008E AMQP error (attempt 1)" error2 = "expected close marker for Object" error3 = "(attempt 3)" # Return contents of the credentials-service-error.log my_return_text = af_support_tools.send_ssh_command(host=ipaddress, username=cli_username, password=cli_password, command=sendCommand, return_output=True) time.sleep(3) assert error1 in my_return_text assert error2 in my_return_text assert error3 not in my_return_text print('Test 7 of 9: Invalid JSON: TEST PASSED\n') print('************************************************') time.sleep(1)
def load_test_data(): import cpsd global cpsd # Update config ini files at runtime my_data_file = os.environ.get('AF_RESOURCES_PATH') + '/continuous-integration-deploy-suite/symphony-sds.properties' af_support_tools.set_config_file_property_by_data_file(my_data_file) # Set config ini file name global env_file env_file = 'env.ini' # Test VM Details global ipaddress ipaddress = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='hostname') global cli_username cli_username = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='username') global cli_password cli_password = af_support_tools.get_config_file_property(config_file=env_file, heading='Base_OS', property='password') # RMQ Details global rmq_username rmq_username = af_support_tools.get_config_file_property(config_file=env_file, heading='RabbitMQ', property='username') global rmq_password rmq_password = af_support_tools.get_config_file_property(config_file=env_file, heading='RabbitMQ', property='password') global port port = af_support_tools.get_config_file_property(config_file=env_file, heading='RabbitMQ', property='ssl_port')
def test_CollectComponentVersion(): the_payload = af_support_tools.get_config_file_property(config_file=payload_file, heading=payload_header, property=payload_property_hal) urlcollect = 'http://' + host + ':5500/v1/amqp/' headers = {'Content-type': 'application/json', 'Accept': 'application/json'} response = requests.post(urlcollect, data=the_payload, headers=headers) print(response.status_code) print("### Waiting for components version retrieval ###") time.sleep(15) assert response.status_code == 200 print('\nTEST: CollectComponentVersions run: PASSED')