* Client How to invoke the client: client Client options ** Available entry point: - test - worker - group - build *** Feature table | entry point | actions | descriptions | |-------------+-------------+-----------------------------------------------------------------------------------------------------| | test | restart | restarts a test. Restarts the parent if the parent status is not success, or if explicity requested | | | stop/cancel | stop/cancel tests that match certain conditions | | | clone | clone a test from a host to another host. | | | status | returns the status of a test (run, failed, softfailed, canceled) | | | search | search for tests according to the inputs | | | info | display several information regarding a test (details, settings, comments, previous results...) | |-------------+-------------+-----------------------------------------------------------------------------------------------------| | worker | search | search for workers according to the inputs | | | info | display several information regarding a worker (host, instance, properties, status...) | |-------------+-------------+-----------------------------------------------------------------------------------------------------| | group | search | search for groups according to the inputs | | | info | display several information regarding a group (name, tests, prio, arch, latest build results) | |-------------+-------------+-----------------------------------------------------------------------------------------------------| | build | search | search for builds according to the inputs | | | info | display build information (flavor, tests, archs, status) | | | restart | restart tests that belongs to a build that match certain conditions | | | new | create a new build according to the parameters passed (equivalent to the current "isos post") | |-------------+-------------+-----------------------------------------------------------------------------------------------------| *** Explanation - test one run of individual test cases Example of a test screen: https://openqa.suse.de/tests/1412943 - worker Test worker that will run the test Example of a worker screen: https://openqa.suse.de/admin/workers/936 - group a group of builds Example of a group screen: https://openqa.suse.de/group_overview/110 - build a group of tests Example of a build screen: https://openqa.suse.de/tests/overview?distri=sle&version=15&build=422.1&groupid=110 **** units 1. group > build > test A group is a bunch of builds. A build is a bunch of tests 2. Worker ** Assumptions 1. The command line options, will have precedence over the options passed over the options file. This means that the options in the options file will not override the options passed via switches in the command line. 2. All the commands need to support a --json-data which will be the equivalent of invoking the action with flags/switches. 3. The default server where the user can do operation is the current host 4. The api key and the api scret can be be specifed on the client.conf file ** Examples *** test - restart restart a test, including the parent Invocations $ client test restart --id $ client test restart --id --from $ client test restart --id $ client test restart --id --vars ISO= possible returns: {"invocation":{"status":0, "message":"ok"}, "returns": []} {"invocation":{"status":0, "message":"ok"}, "returns": [, ]} {"invocation":{"status":1, "message":"unknown remote host"}} {"invocation":{"status":2, "message":"unknown test"}} - stop stop a test Invocations $ client test stop --id $ client test stop --id --from possible returns: {"invocation":{"status":0, "message":"ok"}} {"invocation":{"status":1, "message":"unknown remote host"}} {"invocation":{"status":2, "message":"unknown test"}} - clone clone a test Invocations $ client test clone --id $ client test clone --id --from $ client test clone --id --from --to --vars ISO= possible returns: {"invocation":{"status":0, "message":"ok"}, "returns":{"id": }} {"invocation":{"status":1, "message":"unknown remote host"}} {"invocation":{"status":2, "message":"unknown test"}} {"invocation":{"status":3, "message":"ambigous options"}} - status return the status of the test Invocations: $ client test status --id $ client test status --id --from possible returns: {"invocation":{"status":0, "message":"ok"}, "returns": "failed"} {"invocation":{"status":0, "message":"ok"}, "returns": "softfailed"} {"invocation":{"status":0, "message":"ok"}, "returns": "running"} {"invocation":{"status":0, "message":"ok"}, "returns": "scheduled"} {"invocation":{"status":0, "message":"ok"}, "returns": "passed"} {"invocation":{"status":0, "message":"ok"}, "returns": "skipped"} {"invocation":{"status":1, "message":"unknown remote host"}} {"invocation":{"status":2, "message":"unknown test"}} - search search for tests according to the inputs _note_: for obvious reasons only the last 500 jobs executed plus the current ones will be searched Invocations: $ client test search --result failed The -- flags can be one of the following arch, build, comments, distri, since The since will take either Hours, or Days, and it will return all the tests that were executed since that time. $ client test search --result skipped --from $ client test search --result skipped --from --since 1d possible returns: {"invocation":{"status":0, "message":"ok"}, "returns": [TEST1,TEST2,TEST3]} {"invocation":{"status":0, "message":"ok"}, "returns": []} {"invocation":{"status":1, "message":"unknown remote host"}} {"invocation":{"status":2, "message":"unknown test"}} with TEST being a list of ids - info to display several information according to the options passed. # TODO: how to get the previous results? # http GET https://openqa.suse.de/api/v1/jobs/1421610 # http GET https://openqa.suse.de/api/v1/jobs/1421610/details # http GET https://openqa.suse.de/api/v1/jobs/1421610/comments client test info --id 123 client test info --id 123 --attributes id client test info --id 123 --attributes previous_results --attributes version possible returns: {"invocation":{"status":0, "message":"ok"}, "returns": {"id":, "comments":["comment","comment2"]}} *** worker - status to get the status of a worker $ client worker status --id 123 possible returns: {"invocation":{"status":0, "message":"ok"}, "returns": "Offline"} - info to display several information from the worker according to the options passed $ client worker info --id 123 --display host --display instance possible returns: {"invocation":{"status":0, "message":"ok"}, "returns": {"Host":"openqa", "Instance":"1"}} - search to get a list of workers The --flags can be one of the following: host, instance, alive, connected, property. The propery flag needs to be in the form of KEY=VAL $ client worker search --alive yes --status running $ client worker search --alive yes --status running --propery WORKER_CLASS=qemu_x86_64 {"invocation":{"status":0, "message":"ok"}, "returns": [WORKER1]} With worker 1 containing the following info: { "alive": 0, "connected": 0, "host": "tragicbox", "id": 1, "instance": 1, "properties": { "CPU_ARCH": "x86_64", "CPU_MODELNAME": "Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz", "CPU_OPMODE": "32-bit, 64-bit", "INTERACTIVE": "0", "ISOTOVIDEO_INTERFACE_VERSION": "", "JOBTOKEN": "CEFHLTGGkJgg53b4", "MEM_MAX": "15969", "STOP_WAITFORNEEDLE": "0", "STOP_WAITFORNEEDLE_REQUESTED": "0", "VERSION": "", "WEBSOCKET_API_VERSION": "", "WORKER_CLASS": "qemu_x86_64,qemu_i686,qemu_i586,64bit,svirt-xen,caasp_x86_64,svirt-hyperv", "WORKER_TMPDIR": "/tmp/5_kzfD5Uqd" }, "status": "dead", "websocket": 0 } *** group - search search test groups $ client group search -name functional possible returns { "invocation": {"status": 0, "message": "ok"}, "returns": {"groups": [{"id":ID, "name":"name", "builds":[ID1,ID2]}]} } - display display several information regarding a test group client group search client group display --id 123 --builds_younger 10d *** build - restart Restart tests that match the options $ client build restart --id 123 --filter name=raid --filter status=failure # restarting tests from a build that match the filter options { "invocation": {"status": 0, "message": "ok"}, "returns": {"ids":[ID1, ID2, ID3]} } $ client build restart --id 99999 --name raid # when trying to restart tests of a non existing build { "invocation": {"status": 0, "message": "no build found"} } $ client build restart --id ID # restarts all the tests of this build { "invocation": {"status": 0, "message": "ok"} } - info Display the tests and the results of a build. $ client build info --id 123 --name raid { "invocation": {"status": 0, "message": "ok"}, "returns": [ {"name": "RAID0", "tests": [{"arch":"aarch64","id": 1403568, "status": "softfailed"}, {"arch":"ppc64le","id":1403730, "status":"failed", "failure":"first_boot", "bug": "bsc#1065150"}]}, {"name": "RAID1", "tests": [{"arch":"aarch64","id": 1403586, "status": "softfailed"} ]} ] } $ client build info --id 123 --arch x86_64 { "invocation": {"status": 0, "message": "ok"}, "returns": [ {"name": "RAID0", "tests": [{"arch":"x86_64","id": 1404070, "status": "softfailed"}]}, {"name": "RAID1", "tests": [{"arch":"x86_64","id": 1404101, "status": "softfailed"}]} ] } $ client build info --id 123 --filter status=failed { "invocation": {"status": 0, "message": "ok"}, "returns": [ {"name": "RAID0", "tests": [{"name":"regression test", "arch":"x86_64","id": 1404070, "status": "softfailed"}]} ] } - search search for builds $ client build search --groupid --name # Search a build inside a group id { "invocation": {"status": 0, "message": "ok"}, "returns": { "ids": [ID_TEST1, ID_TEST2,....] } } - new create a new build (equivalent to isos post) $ client build new --group --var KEY=VAL { "invocation": {"status": 0, "message": "ok"}, "returns": { "ids": [ID_TEST1, ID_TEST2,....] } } ** Return value The client calls should always return a json with the mandatory "invocation" table parameter, containing status and message: { "invocation": { "status": 0, "message": "ok" }, } - status If the invocation was ok (0) or not ok (not zero) - message Any message regarding the command execution. Example of invocation that returns a list of some call: { "invocation": { "status": 0, "message": "ok" }, "returns": { "key 1": "value 1", "key 2": "value 2", "key 3": "value 3" "key 4": ["1","2","3"] } }