testkube icon indicating copy to clipboard operation
testkube copied to clipboard

Add json output to kubectl testkube run test

Open marcportabellaclotet-mt opened this issue 2 years ago • 8 comments

Describe the enhancement you'd like to see We would like to parse extraction id after running kubectl testkube run test xxx. Current run test displays a plaintext output, which can be parsed, but is not as safe as json parsing. Would it be possible to add json output for run test?

marcportabellaclotet-mt avatar Jul 23 '22 16:07 marcportabellaclotet-mt

Hey, @marcportabellaclotet-mt We support output format for certain commands and object type. For example, kubectl testkube get execution --output=json, but not for Run command. But we can add it for run command as well

vsukhin avatar Jul 24 '22 18:07 vsukhin

Thanks, that will be very appreciated!!

marcportabellaclotet-mt avatar Jul 25 '22 08:07 marcportabellaclotet-mt

You're welcome @marcportabellaclotet-mt Definitely, it will be a nice improvement for automation of test based workflows, we will add it to our task list

vsukhin avatar Jul 25 '22 10:07 vsukhin

I think we should plan to rewrite UI package - rethink it in terms of errors and output formats. For now we can just put some ifs but on the very end it should be pluggable in some kind

exu avatar Aug 05 '22 07:08 exu

Hi @marcportabellaclotet-mt maybe something like this for now will be enough?

tk run test kubeshop-cypress | grep "Execution ID:" | tr -s ' ' | cut -d ' ' -f 4

exu avatar Aug 23 '22 13:08 exu

Hi @exu , Yes, we are already parsing the execution Id using bash tools. However, this usually breaks pipelines when output format changes, and we prefer to relay on json format. Thanks for comments @exu!! Great tool!!

marcportabellaclotet-mt avatar Aug 24 '22 12:08 marcportabellaclotet-mt

Would it make sense that for the testkube run command we have these fields are json output ?

fields for json output:

  • status: passed/failed
  • logs: ""
  • executionid: ""
  • etc....

TheBrunoLopes avatar Aug 15 '23 10:08 TheBrunoLopes

@jmorante-ks @dejanzele @vsukhin @rangoo94 could you define a good json output spec for our CLI command ?

TheBrunoLopes avatar Oct 24 '23 10:10 TheBrunoLopes