How do I integrate acceptance testing for my project on Jenkins? - python-2.7

I am currently working on a UI project for my team. After building a project on Jenkins, we want to trigger acceptance tests to run. On my local machine, I am able to do so by activating a server.py with the command:
python server.py
After the server is up and running, I can run the acceptance test folder that I have written with the command:
pybot acceptance_tests
I am now trying to migrate my tests from my local machine to Jenkins. What I cannot figure out is how I am able to run the server (server.py) on Jenkins. I am relatively new to Jenkins, so any details will be great!

Instead of starting the server via jenkins, have the test start and stop the server. This will give you the same behavior regardless of how you run your tests (ie: via jenkins for manually from the command line).
Robot has a library named Process which you can use for starting and stopping processes. You can use the Start Process and Terminate Process keywords to start and stop the webserver via a suite setup and suite teardown. It would look something like this:
*** Settings ***
| Library | Process
| Suite Setup | Start the webserver
| Suite Teardown | Stop the webserver
*** Keywords ***
| Start the webserver
| | ${server process}= | Start process | python | server.py
| | Set suite variable | ${server process}
| Stop the webserver
| | Terminate Process | ${server process}
Of course, you'll want to add some bullet proofing such as making sure the server actually starts, and possibly catching errors if it doesn't exit cleanly. You may need to give an explicit path to server.py, but hopefully this gives the general idea.

Related

Stop Django server without control key

I need to kill the Django development server from a shellscript in linux. How can this be done, since the shell script can't hold the 'CONTROL' key? Is there sytnax that performs the same function?
I tried:
$CONTROL-C
$^C
$SIGINT
Use kill to kill the process that is running your Django server:
ps -ax shows you all the running processes, you could ps -ax | grep runserver to just show the processes with runserver in them
kill xxxx kills the process number xxxx

Kill YARN application according to user name

I am looking for a way to kill all YARN applications coming from a specific user.
I know that I can use yarn application -kill [application_ID] command but I have a list of jobs coming from the same user I'd like to kill (all of them).
More precisely, I would like for instance to kill all jobs coming from dr.who.
Is there any way to do that without killing job one by one?
Thank you for your help.
EDIT
My question was asked because one user was submitting unwilling jobs. I wanted to kill them all while I was changing security settings (set up a firewall and blocked everything from outside).
I had to use indeed a workaround to kill running jobs while I was setting the network with a script based on yarn application -kill , yarn application -list | grep "dr.who"and awk. That script is certainly not a good solution.
for i in `yarn application -list | grep -w dr.who | grep -E -o application_[0-9,_]*`; do yarn application -kill $i; done

Ember tutorial - Server not starting after installing ember-cli-mirage

Following along with the ember tutorial and got to installing ember-cli-mirage here. After I install the add-on the server will not start. I get to "Serving on http://localhost:4200/" and then it just hangs there. When I try to kill the server via Ctrl-C it also hangs at "cleaning up...". If I remove ember-cli-mirage from package.json and node_modules then everything will start again.
I have been able to dig around to get live server and other aspects running, but this one is giving me nothing to work with. Are there any additional settings/pieces that the tutorial is missing or do I have a version/environment issue? Is there a way to get additional information at startup (I know --verbose is not one)?
Vagrant: ubuntu/trusty-64 (14.04.5 LTS)
Node: v7.5.0
NPM: v3.10.8
ember-cli: 2.11.1
After more digging this appears to have something to do with Vagrant. I ran through the same steps on my local Windows machine and it loads fine with Node v6.10.0. I then tried that version of Node on Vagrant and left it running while I went out. It ultimately took 19 minutes for the container to come up. The full time was spent in Babel. It doesn't appear to be a memory issue on the VM, not sure what the difference may be and no errors were reported.
Ember Server output from both environs:
Vagrant
vagrant#vagrant-ubuntu-trusty-64:/vagrant/sample$ ember serve
Livereload server on http://localhost:4300
Serving on http://localhost:4200/
Build successful - 1169101ms.
Slowest Nodes (totalTime => 5% ) | Total (avg)
----------------------------------------------+---------------------
Babel (19) | 1106280ms (58225 ms)
Windows
c:\projects\super-rentals>ember server
Livereload server on http://localhost:49153
Serving on http://localhost:4200/
Build successful - 24208ms.
Slowest Nodes (totalTime => 5% ) | Total (avg)
----------------------------------------------+---------------------
Babel (19) | 12332ms (649 ms)
SimpleReplace (2) | 4686ms (2343 ms)
Concat (8) | 3411ms (426 ms)
Funnel: Addon JS (11) | 1289ms (117 ms)

Qt restart application whilst limiting instances to 1

I'm using Qt5.6, I have code which will restart the application, but I also want to limit the number of instances.
The code that limits the instances works and so does the code which restarts the application, but with the limiting code enabled, the application will not restart, it closes down but I'm guessing that the restart is being blocked because at the time it tries to launch the new instance the PID of the original hasn't cleared.
Question is, how to achieve the result of closing the application, whilst limiting the total number of instances to 1 ?
If this hasn't been solved by tomorrow I will post the code for restarting and limiting instances, I don't have it with me at the moment.
Code to restart the application:
qApp->quit();
QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
These are just hints for the watchdog script:
1- you need to use QProcess::startDetached to run your script before quit your App. This will allow the script process to live after exiting your App.
QProcess::startDetached( "bash", QStringList() << "-c" << terminalCommand );
2- you need to pass the current App PID to your watchdog script via terminalCommand
to get the current App PID in Qt use
qApp->applicationPid();
3- in your watchdog script, have infinite loop that checks for the PID by doing
ps aux | grep -v 'grep' | grep $PID
once the PID is dieds, start your app again from your the watchdog script

scheduling Jmeter distributed testing

I am using JMeter's distributed testing feature which works fine. However, when I schedule this distributed run, it just runs immediately and disregards schedules. It happens only for distributed testing. Any idea?
I haven't come across that little gem. Have you tried starting from the command line to see if it works properly?
Step 3b: Start the JMeter from a non-GUI Client
As an alternative, you can start the remote server(s) from a non-GUI (command-line) client. The command to do this is:
jmeter -n -t script.jmx -r
or
jmeter -n -t script.jmx -R server1,server2...
Other flags that may be useful:
-Gproperty=value - define a property in all the servers (may appear more than once)
-Z - Exit remote servers at the end of the test.
The first example will start whatever servers are defined in the JMeter property remote_hosts; the second example will define remote_hosts from the list of servers and then run the remote servers.
The command-line client will exit when all the remote servers have stopped.