Robot Framework: All subsequent tests fail after one test fails - ssh

Once one of my robot test fail, all further tests fail, I can't seem to find out why this happens.
I just execute a simple nslookup on my device and check if the output contains the word 'Name:'
Example:
*** Settings ***
Library SSHLibrary
Suite Setup Open Connection And Log In
Suite Teardown Close All Connections
*** Variables ***
${HOST} localhost
${LOGIN} testUser
${PASSWORD} testUser
*** Keywords ***
Open Connection And Log In
Open Connection ${HOST}
Login ${LOGIN} ${PASSWORD}
*** Test Cases ***
resolve dns domain on google:
Write nslookup qsdf.ft 8.8.4.4
${output}= Read delay=0.5s
Should Contain ${output} Name:
resolve dns domain google.com:
Write nslookup google.com 8.8.4.4
${output}= Read delay=0.5s
Should Contain ${output} Name:
The first test should fail and the second should pass.
It seems like the first test is stil waiting for its output while the other tests continue
my output on both tests:
'' does not contain 'Name:'

Related

How Do I Make Ansible Retry on SSH Errors?

I am occasionally getting SSH failures in my Ansible 2.6.19 playbook during operations that that use file or copy with large with_items. Several items will succeed then at some point I will get
Shared connection to xxx.xyz.com closed
sudo: PAM account management error: Authentication service cannot retrieve authentication info
Then 2 seconds later there is a SUCCESS message for each of the rest of the files. This suggests to me that something must have happened on the server to cause the issue and then it resolved itself.
I have pipelining = True in my ansible.cfg.
How do I make Ansible playbook try again on SSH errors like this so the playbook doesn't fail?
EDIT: To address the comment, I am investigating the source but since I don't have control of it I need a backup. The retry/until is at the task level, however, there are too many tasks to put it on each one. I really need something at a playbook level. e.g. in ansible.cfg
One option at configuration level is use retry files. This will allow you to rerun the playbooks with the --limit #path/to/retry-file option.
Excerpt from ansible.cfg:
retry_files_enabled = True
retry_files_save_path = ~/.ansible-retry
This will cause a <playbook>.retry file to be created (in ~/.ansible-retry/ directory) when a playbook failure occurs. Though it doesn't make Ansible automatically retry, the playbook can be rerun with --limit option to cover the hosts on which failure occurred. This can be combined with error handling (as #Zeitounator commented).
The other option is to use the wait_for_connection module.
- name: wait for connection to host for 2 mins
wait_for_connection:
timeout: 120

bind() failed: Cannot assign requested address (99) error while executing Selenium based automation test in server

I have code for web ui automation test created with Katalon, I have tried to run it locally and it worked well.
Then I push my code to server but when I run it from server, it failed. It failed to open the web/url that i want.
I generate the code to execute test from server but when I run that code this is happened :
bind failed
then it kept loading the browser until it timed out :
Can anyone suggest/comment or help with a solution for this?
This error message...
[SEVERE]: bind() failed: Cannot assign requested address (99)
...implies that the ChromeDriver was unable to bind the Browsing Context i.e. Chrome Browser session.
Initiating ChromeDriver with --verbose flag would have helped to debug the issue in a better way.
Solution
As per the documentation in [Errno 99] Cannot assign requested address when starting Dockerized web app the probhable cause and the solution would be to:
Close all processes that may be running on your port number. Assuming you are running on port 8000:
lsof -t -i tcp:8000 | xargs kill -9
You are probably using an app adress as localhost or 127.0.0.1 and you need to change it to 0.0.0.0
Another possible reason can be, google-chrome attempted to listen on IPv6 address, which was not enabled. You can either enable IPv6 support (which works only on Linux host) or ignore the error since ChromeDriver process will be listening on IPv4 after initial failed attempts.

Jmeter Distributed Testing Not working with two way SSL Handshake

I have tried to do distributed testing with two servers for a request which requires two way SSL handshaking. This is working fine when we are not using remote hosts for testing
sh jmeter.sh -n -t sample_Load_Test/sample_test.jmx -l sample_report/Log/results.jtl -e -o sample_report/Dashboard/
Jmeter Success:
But on trying to use the remote hosts for the same jmx file, the SSL handshake is failing. I have put the same same jmeter.p12 and truststore.jks in all the servers which are used for distribute testing.
Command used:
sh jmeter.sh -n -t sample_test/sample_load_test.jmx -l sample_report/Log/results.jtl -e -o sample_report/Dashboard/ -r -Jserver.rmi.ssl.disable=true
Please see the error that I am getting
Jmeter Failure:
<httpSample t="20" it="0" lt="0" ct="20" ts="1545068074631" s="false"
lb="HTTP Request" rc="Non HTTP response code:
javax.net.ssl.SSLHandshakeException" rm="Non HTTP response message:
Received fatal alert: handshake_failure"
Does anyone knows what I am doing wrong here
I can think of 2 possible causes:
You use different JRE versions on master and slaves and they have different SSL configuration in terms of storing certificates. Make sure you use exactly the same Java runtime everywhere and configuration is the same.
Your test relies on client certificates and on one of the slaves you don't have them defined in system.properties file or in SSL Manager make sure to use the same JMeter version and the same set of config files and external data files on each slave.
Get used to look into jmeter.log and/or jmeter-server.log files - in the majority of cases you should get the reason of the failure or unexpected behavior from the log.

x2go Connection failed. bash: bash: command not found

I want to connect from my home pc with VPN (ubuntu-18.04) to work pc (ubuntu 18.04) using x2go.
Server side installation:
sudo add-apt-repository ppa:x2go/stable
sudo apt-get update
sudo apt-get install x2goserver x2goserver-xsession
Client side installation:
sudo apt-get install x2goclient
I am able to ssh to my remote desktop, but x2go doesn't work. Problem seems to be in the server side, since I tried to x2go connect from different computer (CentOs) and error was the same.
Client session preferences window:
I tried almost everything in session preferences, even with RSA key (I have it) or single application session type and many else, always the same error.
Client debug log: (x2goclient --debug)
x2go-INFO-1> "Starting X2Go Client 4.1.2.1..." x2go-WARNING-1> English
language requested, not loading translator. x2go-WARNING-1> English
language requested, not loading translator. Object::connect: No such
slot ONMainWindow::slotCheckAgentProcess() x2go-INFO-3> "Started X2Go
Client." x2go-DEBUG-../src/onmainwindow.cpp:563> "$HOME=/home/XXX"
x2go-DEBUG-../src/onmainwindow.cpp:2242> Reading 1 sessions from
config file. x2go-DEBUG-../src/sessionbutton.cpp:342> Creating QPixmap
with session icon: ":/img/icons/128x128/x2gosession.png".
x2go-DEBUG-../src/onmainwindow.cpp:12843> libssh not initialized yet.
Initializing. x2go-DEBUG-../src/onmainwindow.cpp:2728> Creating
QPixmap with session icon: '":/img/icons/128x128/x2gosession.png"'.
x2go-DEBUG-../src/onmainwindow.cpp:2795> Starting session via Smart
Card, SSH Agent or Kerberos token. x2go-INFO-8> "Starting connection
to server: 192.168.29.15:22" x2go-DEBUG-../src/onmainwindow.cpp:2829>
Starting new ssh connection to server:"192.168.29.15":"22" krbLogin:
false x2go-DEBUG-../src/sshmasterconnection.cpp:175>
SshMasterConnection, host "192.168.29.15"; port 22; user "XXX";
useproxy false; proxyserver "192.168.29.15"; proxyport 22
x2go-DEBUG-../src/sshmasterconnection.cpp:248> Starting SSH connection
without Kerberos authentication.
x2go-DEBUG-../src/sshmasterconnection.cpp:252> SshMasterConnection,
instance SshMasterConnection(0x56102247dbe0) created.
x2go-DEBUG-../src/sshmasterconnection.cpp:520> SshMasterConnection,
instance SshMasterConnection(0x56102247dbe0) entering thread.
x2go-DEBUG-../src/sshmasterconnection.cpp:840> Session port before
config file parse: 22 x2go-DEBUG-../src/sshmasterconnection.cpp:850>
Session port after config file parse: 22
x2go-DEBUG-../src/sshmasterconnection.cpp:915> Session port before
config file parse (part 2): 22
x2go-DEBUG-../src/sshmasterconnection.cpp:925> Session port after
config file parse (part 2): 22
x2go-DEBUG-../src/sshmasterconnection.cpp:950> cserverAuth
x2go-DEBUG-../src/sshmasterconnection.cpp:991> state: 1
x2go-DEBUG-../src/sshmasterconnection.cpp:1364> userAuthAuto failed:""
(code 1)
x2go-DEBUG-../src/sshmasterconnection.cpp:1274> Trying password
mechanism if available.
x2go-DEBUG-../src/sshmasterconnection.cpp:1278> Password mechanism
available. Continuing.
x2go-DEBUG-../src/sshmasterconnection.cpp:726> User authentication OK.
x2go-DEBUG-../src/sshmasterconnection.cpp:1789> LOGIN CHECK:"LOGIN OK
" x2go-DEBUG-../src/sshmasterconnection.cpp:1792> don't have
interaction x2go-DEBUG-../src/sshmasterconnection.cpp:1825> LOOP
FINISHED x2go-DEBUG-../src/sshmasterconnection.cpp:1829> No
interaction needed, continue session
x2go-DEBUG-../src/sshmasterconnection.cpp:735> Login Check - OK
x2go-DEBUG-../src/onmainwindow.cpp:2923> SSH connection established.
x2go-DEBUG-../src/onmainwindow.cpp:3336> Continue normal X2Go session
x2go-DEBUG-../src/sshprocess.cpp:199> Executing remote command via
SshProcess object 0: "x2golistsessions"
x2go-DEBUG-../src/sshprocess.cpp:213> this=SshProcess(0x5610224a1f30)
Running masterCon->addChannelConnection(this, '
"1d4dfc1a-7f4d-4f00-b39e-07273d3d973d" ', ' "bash -l -c 'echo
"X2GODATABEGIN:1d4dfc1a-7f4d-4f00-b39e-07273d3d973d"; export
PATH="/usr/local/bin:/usr/bin:/bin";export TERM="dumb";
x2golistsessions; echo "X2GODATAEND:1d4dfc1a-7f4d-4f00-b39e-07273d"
'); x2go-DEBUG-../src/sshmasterconnection.cpp:1891> Locking SSH
channel connection MUTEX.
x2go-DEBUG-../src/sshmasterconnection.cpp:1893> Passing new channel
connection object to channelConnections.
x2go-DEBUG-../src/sshmasterconnection.cpp:1895> Unlocking SSH channel
connection MUTEX. x2go-DEBUG-../src/sshmasterconnection.cpp:2083>
Creating new channel.
x2go-DEBUG-../src/sshmasterconnection.cpp:2100> New
channel:0x7fcf84012aa0
x2go-DEBUG-../src/sshmasterconnection.cpp:2185> Executing remote:
"bash -l -c 'echo
"X2GODATABEGIN:1d4dfc1a-7f4d-4f00-b39e-07273d3d973d"; export
PATH="/usr/local/bin:/usr/bin:/bin";export TERM="dumb";
x2golistsessions; echo
"X2GODATAEND:1d4dfc1a-7f4d-4f00-b39e-07273d3d973d";'"
x2go-DEBUG-../src/sshmasterconnection.cpp:2208> New exec channel
created.
x2go-DEBUG-../src/sshmasterconnection.cpp:2257> EOF on channel
0x7fcf84012aa0; SshProcess object: 0
x2go-DEBUG-../src/sshmasterconnection.cpp:2380> EOF sent.
x2go-DEBUG-../src/sshmasterconnection.cpp:2384> Channel closed.
x2go-DEBUG-../src/sshprocess.cpp:526> SSH finished: raw output
(stdout): "" x2go-DEBUG-../src/sshprocess.cpp:532> Have stderr only,
something must be wrong. x2go-DEBUG-../src/sshprocess.cpp:537> SSH
finished: false - "bash: bash: command not found " (0).
x2go-DEBUG-../src/onmainwindow.cpp:3804> "bash: bash: command not
found
If someone was interested, I can show server's side /var/log/syslog
Thank you for your help
Please try moving your .bashrc aside and retry.
It was my bad, silly me. I had a typo in /etc/environment file and I didn't notice it because I haven't restarted my PC after that typo. After fixing it, it worked.

SSL handshake with ActiveMQ server gives NullPointerException when connecting via SilverTunnel netlib

Summary
Connecting to ActiveMQ via TCP works fine with or without netlib.
Connecting via SSL works fine without netlib but fails with netlib.
Note: I'm using apache-activemq-5.6.0 and silvertunnel.org_netlib-0.14-beta.
This problem occurs whether using netlib's tcpipNetLayer or torNetLayer. However, only the tcpipNetLayer case is considered here to keep things simple.
BTW, SSL + netlib worked fine with the HornetQ messaging server (which implements SSL authentication differently) but HornetQ had problems that led me to try using ActiveMQ.
For convenience I have created a simple test case with a consumer and two different producers.
producer connects without netlib - works fine.
producer-tcpip connects with neltib using the tcpipNetLayer - the following errors occur:
With SSL debugging turned on for ActiveMQ the producer-tcpip program outputs to the console the following error message and then hangs:
ActiveMQ Transport: ssl://null:0, handling exception: java.lang.NullPointerException
This is midway through an SSL handshake because the producer-tcpip program generates the log4j message:
DEBUG org.apache.activemq.transport.failover.FailoverTransport - Attempting 0th connect to: ssl://localhost:61616
DEBUG org.apache.activemq.transport.WireFormatNegotiator - Sending: WireFormatInfo { version=9, properties={MaxFrameSize=104857600, CacheSize=1024, CacheEnabled=true, SizePrefixDisabled=false, MaxInactivityDurationInitalDelay=10000, TcpNoDelayEnabled=true, MaxInactivityDuration=30000, TightEncodingEnabled=true, StackTraceEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
Then when the producer-tcpip program is killed (e.g. with a ctrl+C) then the activemq.log reports that:
WARN | Transport Connection to: tcp://127.0.0.1:49463 failed: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: ssl:///127.0.0.1:49463
ERROR | Could not accept connection from tcp://127.0.0.1:49463: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake | org.apache.activemq.broker.TransportConnector | ActiveMQ Task-3
I have no idea what could be causing this or how it can be resolved. Can anyone help?
Steps to reproduce the problem (takes under 15 minutes):
download the test case
wget http://anandavala.info/miscl/testing-AMQ-Netlib-SSL.zip
unzip testing-AMQ-Netlib-SSL.zip
rm testing-AMQ-Netlib-SSL.zip
cd testing-AMQ-Netlib-SSL
Download latest ActiveMQ into the testing directory
wget https://www.apache.org/dist/activemq/apache-activemq/5.6.0/apache-activemq-5.6.0-bin.tar.gz
tar -xzf apache-activemq-5.6.0-bin.tar.gz
rm apache-activemq-5.6.0-bin.tar.gz
Edit conf/activemq.xml to accept ssl
gedit apache-activemq-5.6.0/conf/activemq.xml
replace the transportConnectors entry with the following lines (to enable SSL)
<transportConnectors>
<transportConnector name="ssl" uri="ssl://0.0.0.0:61616?needClientAuth=true"/>
</transportConnectors>
<sslContext>
<sslContext
keyStore="broker.ks" keyStorePassword="password"
trustStore="client.ks" trustStorePassword="password"/>
</sslContext>
start server
cd apache-activemq-5.6.0
bin/activemq start
view logging output
tail -f data/activemq.log
open another console then cd into the testing-AMQ-Netlib-SSL directory
Download latest SilverTunnel netlib into the testing directory
wget http://sourceforge.net/projects/silvertunnel/files/silvertunnel_Netlib/silvertunnel.org_netlib-0.14-beta.zip
unzip silvertunnel.org_netlib-0.14-beta.zip
rm silvertunnel.org_netlib-0.14-beta.zip
compile the source code into three runnable jar files in separate directories
ant
run the consumer
cd consumer
./consumer
open another console then cd into the testing-AMQ-Netlib-SSL/producer directory
run the producer
./producer
let it run for a bit to satisfy yourself that it works then kill the producer by hitting ctrl+C
run the producer-tcpip
cd ../producer-tcpip
./producer-tcpip
let it run for a bit to satisfy yourself that it has stalled at a NullPointerException then kill the producer-tcpip by hitting ctrl+C
notice the debug message in producer-tcpip's output
tail -f logs/output.log
also notice the error message that appears at the bottom of activemq.log (see the tail output from the first console window) or type at the current prompt
tail -f ../apache-activemq-5.6.0/data/activemq.log
Thanks for your help!