how to upload the result using .xml file in testrail byusing testrail API - testrail

I am executing automated tests in C# and have generated result file using JunitXml.TestLogger nugget package.
I would like to upload the these test result using directly the result xml file .
I have 1 example in python on gurouk blog. https://blog.gurock.com/test-automation-step-four/
I would like to do the same using curl.
if I do it like curl -H "Content-Type: application/json" -u "username:password" "https://testrailurl//index.php?/api/v2/add_results_for_cases/1111" -f "Junitresults.xml"
I get the error
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 60 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
curl: (22) The requested URL returned error: 404
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: Junitresults.xml

Related

" bash: jq: command not found" after adding jq execuable file to env variable (windows) [duplicate]

This question already has answers here:
How to run jq from gitbash in windows?
(8 answers)
Closed 2 years ago.
I wanted to test a json file locally with command (in bash)curl "https://jsonplaceholder.typicode.com/users" | jq by following this tutorial video: https://www.youtube.com/watch?v=rrjIVepRqPI
I followed each step and added the executable file in the env variable path, but not working at all, I got result:
$ curl "https://jsonplaceholder.typicode.com/users" | jq
bash: jq: command not found
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4670 0 4670 0 0 8584 0 --:--:-- --:--:-- --:--:-- 8584
curl: (23) Failed writing body (795 != 1369)
Am I missing anything? Why I still got error bash: jq: command not found??
You can run a jq.exe from git bash.
You only need to install it in your git bash PATH:
curl -L -o /usr/bin/jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe
Then jq will work with your pipe command.

"Exception: No data to insert" while importing dataset into Clickhouse under Docker

I'm trying to play with Clickhouse using this manual. I've set up docker image. I've also successfully created a table:
CREATE TABLE tax_bills_nyc
(
bbl Int64,
owner_name String,
address String,
tax_class String,
tax_rate String,
emv Float64,
tbea Float64,
bav Float64,
tba String,
property_tax String,
condonumber String,
condo String,
insertion_date DateTime MATERIALIZED now()
)
ENGINE = MergeTree
PARTITION BY tax_class
ORDER BY owner_name
Ok.
I quit Clickhouse client and checked Docker container is up:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
55991995335b yandex/clickhouse-server "/entrypoint.sh" About an hour ago Up About an hour 8123/tcp, 9000/tcp, 9009/tcp some-clickhouse-server
I try to import sample dataset with the following command:
curl -X GET 'http://taxbills.nyc/tax_bills_june15_bbls.csv' | docker run --rm --link some-clickhouse-server:clickhouse-server yandex/clickhouse-client --host clickhouse-server --input_format_allow_errors_num=10 --query="INSERT INTO test_database.tax_bills_nyc FORMAT CSV"
And I get the following error:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 176M 0 2641 0 0 7494 0 6:50:28 --:--:-- 6:50:28 7481Code: 108. DB::Exception: No data to insert
0 176M 0 94321 0 0 35245 0 1:27:16 0:00:02 1:27:14 35233
curl: (23) Failed writing body (0 != 16384)
What could be the reason and how to fix that?
I am a bit confused, because docker run is used for running (starting not existed) container. I am not sure, that docker run is what you suppose to do after successfully check your container is running.
Instead of docker run you should use
docker exec -i <container-id-or-name>
So, your line should be:
curl -X GET 'http://taxbills.nyc/tax_bills_june15_bbls.csv' | docker exec -i some-clickhouse-server --query="INSERT INTO test_database.tax_bills_nyc FORMAT CSV"
You could always find info about docker commands in official documentation

Output from a curl command using system.run

I have an active Zabbix item running a curl command on my server.
Key:
system.run[curl http://localhost:8080/mypage]
When I run this curl command manually the output is a number, but in Zabbix I get:
Output:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 3 100 3 0 0 434 0 --:--:-- --:--:-- --:--:-- 500
146
The only thing I want to see is the '146' at the end, can I stop Zabbix from outputting the other information.
Preferably I would like the data type to be numeric - decimal but I'm having to set it to text for the item to work. Am I going about this the wrong way?
Add -s (--silent) parameter to curl, like so:
system.run[curl -s http://localhost:8080/mypage]

export neo4j data to JSON with cURL

curl -b -j "Content-Type: application/json" -d '["quer
y:"{"MATCH n RETURN n"}]' http://localhost:7474/db/data/
curl: (6) Could not resolve host: Content-Type
Hello,
i want get JSON from. With curl and write it to a local file.
So i can do other things with it.
But when executing this command i get could not resolve Content-Type.
i've tried:
curl -b -j Content-Type: application/json' without the double quotation mark ("")
but then i get this as result
curl: (6) Could not resolve host: Content-Type
curl: (6) Could not resolve host: application
Now i've fixed this syntax error
curl -b -j -d '["query:"{"MATCH n RETURN n"}]' http://
localhost:7474/db/data/ -o .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 28 0 0 100 28 0 13 0:00:02 0:00:02 --:--:-- 13
But no data:(
I had success with:
curl -b -j -H "Content-Type: application/json" -d '{"query":"match n return n limit 10"}}' http://localhost:7474/db/data/cypher

10 Second Delay Before Curl POST due to ipv6 (Ubuntu)

NOTE: I don't want to delete any of the history below, but where I thought this was a Heroku issue before, it is not. I think it is an issue with my local machine sending posts via curl and ruby Net::HTTP
I'm currently beginning to work on a rails app on Heroku (free) and in order to get some test data into the app I have a rake task that takes the test data from my DEV DB and posts to a JSON REST API on the heroku app like so:
uri = URI.parse("http://SITENAME.herokuapp.com")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new("/users.json")
request.add_field('Content-Type', 'application/json')
request.body = {'user' => User.first.to_hash }.to_json
response = http.request(request)
For some reason, every request takes almost exactly 10 seconds. I then changed the top line to:
uri = URI.parse("http://localhost:3000")
...and the requests process incredibly fast. Does anybody know if Heroku is slowing down POSTS on the free version? (it would make sense since they want you to pay for the worker dyno) I'm eventually going to pony up for the paid version, but want to get a little further in my DEV before doing so. Also, if they're not intentionally slowing them down, I'm a little hesitant to use them until I know why the posts are taking so long. The line that is taking 10 seconds is:
response = http.request(request)
I'm sure that was obvious, but I figured I'd mention it.
UPDATE 3/12
Just wanted to post some of my logs from today. All of the requests are taking 10 seconds:
1400
Before: 2013-03-12 21:30:33 UTC
After: 2013-03-12 21:30:43 UTC
1401
Before: 2013-03-12 21:30:43 UTC
After: 2013-03-12 21:30:54 UTC
1402
Before: 2013-03-12 21:30:54 UTC
After: 2013-03-12 21:31:04 UTC
1403
Before: 2013-03-12 21:31:04 UTC
After: 2013-03-12 21:31:14 UTC
1404
Before: 2013-03-12 21:31:14 UTC
After: 2013-03-12 21:31:24 UTC
1405
Before: 2013-03-12 21:31:24 UTC
After: 2013-03-12 21:31:34 UTC
UPDATE 3/15
To make sure it wasn't just the Net::HTTP::Post library causing the block I made the same request as above with curl and it also took 10 seconds:
curl -X POST -H "Content-type: application/json" -d {"params":{"q":"query"} http://SITENAME.herokuapp.com/users.json
Anybody have a heroku trick I can use (other than new_relic) to tell where the delay is happening?
UPDATE 3/15 #2
Just switched to unicorn on my Heroku app and still getting the 10 second delay with both Ruby Net::HTTP::Post and using curl from the shell. Switching to localhost, the post comes back immediately.
UPDATE 3/28
Per recent comment, posting the heroku logs with extremely fast response times:
2013-03-29T03:22:06+00:00 app[web.1]: Started POST "/user.json" for IP
2013-03-29T03:22:06+00:00 app[web.1]: Parameters: {"user"=>{data}}
2013-03-29T03:22:06+00:00 app[web.1]: Processing by UserController#create as JSON
2013-03-29T03:22:06+00:00 app[web.1]: User Load (2.2ms) <<<SQL>>>
2013-03-29T03:22:06+00:00 app[web.1]: Completed 200 OK in 3ms (Views: 0.1ms | ActiveRecord: 2.2ms)
2013-03-29T03:22:06+00:00 heroku[router]: at=info method=POST path=/users.json host=HOST.herokuapp.com fwd="66.31.201.99" dyno=web.1 connect=2ms service=33ms status=200 bytes=16
2013-03-29T03:22:16+00:00 app[web.1]: Started POST "/users.json" for 66.31.201.99 at 2013-03-29 03:22:16 +0000
2013-03-29T03:22:16+00:00 app[web.1]: Processing by UserController#create as JSON
2013-03-29T03:22:16+00:00 heroku[router]: at=info method=POST path=/users.json host=HOST.herokuapp.com fwd="66.31.201.99" dyno=web.1 connect=8ms service=19ms status=200 bytes=16
2013-03-29T03:22:16+00:00 app[web.1]: Parameters: Parameters: {"user"=>{data}}
2013-03-29T03:22:16+00:00 app[web.1]: User Load (2.0ms) SQL
2013-03-29T03:22:16+00:00 app[web.1]: Completed 200 OK in 3ms (Views: 0.1ms | ActiveRecord: 2.0ms)
UPDATE 3/28 #2
Just tried the curl from an online shell: www.compileonline.com/execute_bash_online.php and it returned immediately, so I guess it's something with my machine. Anybody know how I can troubleshoot where a curl is getting caught. The format of the request that is 10 seconds locally but instantaneous in the online shell is:
curl -X POST -H "Content-type: application/json" -d '{"user":"payload"}' http://APP.herokuapp.com/users.json
UPDATE 3/28 #3
Something on my machine is causing the delay. I ran the following to get the current system time and then perform the curl in verbose mode and the 10 second delay happens before the curl is even sent:
date +"%T" && curl -X POST -H "Content-type: application/json" -d '{"user":"payload"}' http://APP.herokuapp.com/users.json -v --trace-time -S
...and the output...
00:44:16 [start time from date +"%T"]
00:44:26.653510 * About to connect() to APP.herokuapp.com port 80 (#0)
00:44:26.653632 * Trying 184.72.248.52... connected
00:44:26.675676 > POST /users.json HTTP/1.1
00:44:26.675676 > User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
00:44:26.675676 > Host: APP.herokuapp.com
00:44:26.675676 > Accept: */*
00:44:26.675676 > Content-type: application/json
00:44:26.675676 > Content-Length: 653
00:44:26.675676 >
00:44:26.675954 * upload completely sent off: 653out of 653 bytes
00:44:26.717286 < HTTP/1.1 200 OK
00:44:26.717380 < Cache-Control: max-age=0, private, must-revalidate
00:44:26.717518 < Content-Type: application/json; charset=utf-8
00:44:26.717552 < Date: Fri, 29 Mar 2013 04:44:33 GMT
00:44:26.717584 < Etag: "7363e85fe9edee6f053a4b319588c086"
00:44:26.717616 < Status: 200 OK
00:44:26.717647 < X-Rack-Cache: invalidate, pass
00:44:26.717678 < X-Request-Id: 19ff002048e4e2d5e17a8203576a4194
00:44:26.717708 < X-Runtime: 0.008901
00:44:26.717739 < X-Ua-Compatible: IE=Edge,chrome=1
00:44:26.717771 < transfer-encoding: chunked
00:44:26.717802 < Connection: keep-alive
00:44:26.717832 <
00:44:26.717925 * Connection #0 to host APP.herokuapp.com left intact
00:44:26.717998 * Closing connection #0
You can see the 10 second delay between the initial timestamp and the connect() call. I already tried to see if resolving the host was the issue by doing host APP.herokuapp.com in my shell, but that returns immediately.
UPDATE 3/28 #4
I've updated the above example to include the -4 flag so that it forces using ipv4 and it returns immediately on my development machine:
date +"%T" && curl -4 -X POST -H "Content-type: application/json" -d '{"user":"payload"}' http://APP.herokuapp.com/users.json -v --trace-time -S
I tried disabling ipv6 on my machine using the steps at http://www.upubuntu.com/2011/05/how-to-disable-ipv6-under-ubuntu.html, but it's still not working. Now the problem is that the requests I want to make are through Net::HTTP and HTTParty, so I'd like to fix the IPv6 issue system-wide, so this band-aid on the curl is not a solution.
What do the logs on Heroku indicate for the time used to process your requests? The logs are accurate with all the apps I've run on Heroku (both dev and production) with respect to time used. Are the heroku logs showing 10 seconds used for each request or is that some timing mechanism on the client side?
I would try removing some part of the code path temporarily to see if you can narrow down what might be taking up the time. For example, you might skip trying to render any complex views but instead render a 200 right from the controller. Next, maybe try commenting out the controller code. Keep taking out various parts until you find what is consuming the time.