System Testing a Mongoose Server - c++14

I'm curious as to the best/correct way to setup System level black-box tests for a Mongoose C++ based Web Application project I've been working on. This needs to run in an automatic way within a jenkins script.
The idea is to run something like:
1. Start the server
2. Submit HTTP Get requests with predefined query parameters
3. Check that the result is as expected.
4. Run (2), (3) with different combinations
5. Close the server
One possible way to do this is to whip up a python script which runs the executable generate by make, runs the tests and then kills the spawned process.
Is there a better/more structured way of doing this(and accompanying tools/libraries) either using Python or C++?

Related

Access to Express.js and Prisma console

So im building app based on Express and using Prisma ORM. What i need is to SSH to a server, open up express.js console and create new db entry using prisma. Something similar to python manage.py shell for Django or rails console for Rails. Is there a solution for this of any kind?
Like I pointed in the comment there is a way ( kind of ) to get access to a running express instance. If that's all you need follow:
How can I open a console to interact with Express app?
Express doesn't exactly have a feature like rails console which is a framework feature in that case.
That said, I question the long term implication of this approach. If you really just need to seed some data, write an "init" script, and call it after you ssh into a server or using some CI/CD approach. This is more re-usable, since you can even pass a json file to the script to load dynamic data.
Also, Prismajs has an official way to seed the data ( if that's what you need) that you can leverage:
https://www.prisma.io/docs/guides/database/seed-database
UPDATE:
If you are able to run to code on your machine and point the remote database, then you can use node --inspect to debug in a chrome console. Which should give you about the same effect as a rails REPL
https://medium.com/#tbernardes/debugging-nodejs-with-chrome-inspector-devtools-1cd2ef323b5e

Debugging elastic search code with IntelliJ

I am trying to debug the Elasticsearch source code with IntelliJ. I built the source with IntelliJ and the current Program argument is start. I tried passing the parameters necessary to create an index in the program argument section but it doesn't seem to work. Where do I need to pass the parameters to create indices or perform other operations?
To being testing/debugging requests, you will need to start the server by adding the start command as a Program argument. Once the server has started, open up a terminal and provide curl commands. You can place break points in the code to view the workflows involved.

Running a custom Node script on DocPad server

Say I want to run a custom Node script on my DocPad server once a day (like a cron job), where would I put it? I can build a Node script that does stuff after an interval, I'm more curious about where to reference / run the script in the DocPad server.
A plugin is possible, though I've seen that you can require Node libraries within the DocPad configuration file so it could go in there.
Is there a suggested way to approach this?
If you're wanting something purely cron-like, probably using the docpadReady event would be the way to go, doing something like:
docpadReady: ->
require('schedule').every('2 minutes').do ->
require('safeps').spawn('your cron job')
Alternatively, maybe DocPad's regenerateEvery configuration option is suitable. This tells DocPad to regenerate every X millseconds, which will naturally call the generate events that you could hook into.
Alternatively, is there a need for these crons to run on the same server as DocPad? If not, you could do them completely separately.
A final option, is to see if your server you are deploying to supports spawning multiple files. So DocPad's Server is spawned, and so is cron, with DocPad not knowing about the cron task at all.

How to debug a lotus script agent inside a lotus script agent

I am debugging a lotus script agent using debug a lotus script. Agent is debugging fine but I have another lotus script agent inside that and my debugger is not going to that code line by line.Please help me how to do this.
Thanks in advance.
An agent, that is called in script from another agent runs in the background. These agents can not be debugged easily. If the called agent runs on the server, you can use the remote debugger, to debug that agent: you have to enable it in the server document, start the remote debug task, and enable remote debugging in the properties of the called agent. Then you have to be fast. You define a delay that each agent waits for the debugger to attach, before it really starts with its code. During this time, you have to start the remote debugger, open the database and select the agent to debug... Quite painful. And the normal Debugger has to be off and the agent you startet has to run in client background mode, otherwise you will not be able to switch to remote debugger...
If both agents are LotusScript and it is not needed, that they:
Run with different rights or
Run on different servers,
then there normally is no need for an agent calling another agent.
Use script- libraries and subs / functions instead, then you do not need two agents...
I recommend to you use a simple log in the second agent. You can use NotesLog (look at Domino Developer's Help), or you can write your own class as you need it.
In my apps, I use a LotusScript framework, written by me. In that framework, I have a CS_Log class, who connects to a LogAgents.nsf database and writes all in simple documents. Also, I have a CS_Document class, with a Dump method, who writes the full content of a document, for example.
The most times, debugging it's the best option. But in cases like this, I prefer to write all in a log.

Working with Flask-Script and cron jobs

So I've been meaning to create a cron job on my prototype Flask app running on Heroku. Searching the web I found that the best way is by using Flask-Script but I fail to see the point of using it. Do I get easier access to my app logic and storage info? And if I do use Flask-Script, how do I organize it around my app? I'm using it right now to start my server without really knowing the benefits. My folder structure is like this:
/app
/manage.py
/flask_prototype
all my Flask code
Should I put the 'script.py' to be run by the Heroku Scheduler on app folder, the same level as manage.py? If so, do I get access to the models defined within flask_prototype?
Thank you for any info
Flask-Script just provides a framework under which you can create your script(s). It does not give you any better access to the application than what you can obtain when you write a standalone script. But it handles a few mundane tasks for you, like command line arguments and help output. It also folds all of your scripts into a single, consistent command line master script (this is manage.py, in case it isn't clear).
As far as where to put the script, it does not really matter. As long as manage.py can import it and register it with Flask-Script, and that your script can import what it needs from the application you should be fine.

Resources