Skip to content

feat: cli: status line#988

Merged
ajzobro merged 45 commits intomainfrom
status-line
Apr 15, 2026
Merged

feat: cli: status line#988
ajzobro merged 45 commits intomainfrom
status-line

Conversation

@ajzobro
Copy link
Copy Markdown
Collaborator

@ajzobro ajzobro commented Mar 27, 2026

Description

In the testflinger CLI there are several cases where the user may watch live output: the submit --poll, poll, and reserve sub-commands (fix in #983, this builds upon that PR) all poll the live logs from the agent running the job.

Without affecting how piped or redirected output is displayed, this PR adds a StatusLine for the display of ephemeral information and timers rather than printing "Waiting for output" and other periodic messages to the stream.

When run in an interactive TTY, the CLI will provide a StatusLine to show a timer (count up, or in the case of the reserve state, count down) which displays the state of the job.

Resolved issues

Resolves https://warthogs.atlassian.net/browse/CERTTF-838 (#930)

Documentation

Web service API changes

N/A

Tests

Many new unit tests were added and a repeated testing was done on console to ensure that this worked in both interactive environements, e.g.:

uv run testflinger --server http://testflinger-staging.canonical.com submit --poll ../staging_interactive.yaml

As well as non-interactive environments, e.g.:

uv run testflinger --server http://testflinger-staging.canonical.com submit --poll ../staging_interactive.yaml | tee
or
uv run testflinger --server http://testflinger-staging.canonical.com submit --poll ../staging_interactive.yaml > /tmp/foo

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 94.16404% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.78%. Comparing base (b796e8d) to head (ced84ca).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #988      +/-   ##
==========================================
- Coverage   75.48%   74.78%   -0.70%     
==========================================
  Files         112      111       -1     
  Lines       11082    10664     -418     
  Branches      941      908      -33     
==========================================
- Hits         8365     7975     -390     
+ Misses       2505     2489      -16     
+ Partials      212      200      -12     
Flag Coverage Δ *Carryforward flag
agent 74.58% <ø> (-1.21%) ⬇️ Carriedforward from e2d66a2
cli 91.37% <94.16%> (+0.96%) ⬆️
device 57.58% <ø> (-5.11%) ⬇️ Carriedforward from e2d66a2
server 87.75% <ø> (+0.88%) ⬆️ Carriedforward from e2d66a2

*This pull request uses carry forward flags. Click here to find out more.

Components Coverage Δ
Agent 74.58% <ø> (-1.21%) ⬇️
CLI 91.37% <94.16%> (+0.96%) ⬆️
Common ∅ <ø> (∅)
Device Connectors 57.58% <ø> (-5.11%) ⬇️
Server 87.75% <ø> (+0.88%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ajzobro ajzobro marked this pull request as ready for review March 30, 2026 20:04
@ajzobro ajzobro requested a review from tang-mm March 30, 2026 20:20
Copy link
Copy Markdown
Collaborator Author

@ajzobro ajzobro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updates to copyrights.

Comment thread cli/testflinger_cli/status_line.py Outdated
Comment thread cli/tests/test_status_line.py Outdated
Comment thread cli/tests/conftest.py Outdated
Comment thread cli/tests/test_get_job_data.py
Comment thread cli/tests/test_status_line.py Outdated
ajzobro added 2 commits March 30, 2026 15:27
Co-authored-by: Andy Zobro <241730435+ajzobro@users.noreply.github.com>
@ajzobro ajzobro changed the title Status line feat: cli: status line Mar 30, 2026
@ajzobro ajzobro requested a review from rene-oromtz March 30, 2026 22:16
Copy link
Copy Markdown
Contributor

@rene-oromtz rene-oromtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this addition! This should help clear out the Waiting for Output message. Just added some comments but overall looks good and you already tested in the demo

Comment thread cli/testflinger_cli/__init__.py Outdated
Comment thread cli/testflinger_cli/__init__.py Outdated
Comment thread cli/testflinger_cli/__init__.py Outdated
Comment thread cli/testflinger_cli/__init__.py
Comment thread cli/testflinger_cli/__init__.py
Comment thread cli/testflinger_cli/status_line.py Outdated
Comment thread cli/testflinger_cli/status_line.py Outdated
Comment thread cli/testflinger_cli/status_line.py Outdated
Comment thread cli/testflinger_cli/status_line.py Outdated
Comment thread cli/testflinger_cli/status_line.py Outdated
…pdates to regenerate the graphic e.g.: make vhs && make html && make serve
@ajzobro ajzobro marked this pull request as draft April 7, 2026 20:24
@ajzobro
Copy link
Copy Markdown
Collaborator Author

ajzobro commented Apr 7, 2026

converting to draft while I work out a bug I found in my efforts to make a nice example picture (gif)

ajzobro added 5 commits April 8, 2026 09:38
…havior with respect to printing duplicate status lines, when to print previous status duration information
…me to see the demo; The demo is still made the same way, just uses the other output
complete -F _ksi_completions edit-in-kitty
complete -F _minimal asciinema
complete -F _longopt head
complete -F _service /etc/init.d/rsync
complete -F _service /etc/init.d/cryptdisks-early
complete -F _longopt uniq
complete -F _command else
complete -F _ksi_completions clone-in-kitty
complete -F _service /etc/init.d/ipmievd
complete -F _longopt mkfifo
complete -F _longopt tee
complete -F _service /etc/init.d/x11-common
complete -F _longopt grep
complete -F _filedir_xspec vi
complete -F _longopt objdump
complete -F _longopt sha1sum
complete -F _longopt cut
complete -F _service /etc/init.d/plymouth
complete -F _command nohup
complete -F _service /etc/init.d/ipmiutil_wdt
complete -a unalias
complete -u groups
complete -F _longopt texindex
complete -F _known_hosts telnet
complete -F _command vsound
complete -F _service /etc/init.d/cups
complete -c which
complete -F _longopt m4
complete -F _service /etc/init.d/pcscd
complete -F _longopt cp
complete -F _longopt base64
complete -F _longopt strip
complete -o bashdefault -o default -o nospace -F __git_wrap__gitk_main gitk
complete -v readonly
complete -o nospace -F _cd cd
complete -F _known_hosts showmount
complete -F _longopt tac
complete -F _known_hosts fping
complete -F _longopt env
complete -c type
complete -F _known_hosts ssh-installkeys
complete -F _longopt expand
complete -o bashdefault -o default -o nospace -F __git_wrap__git_main git
complete -F _longopt ln
complete -F _command aoss
complete -o default -o nospace -F _virtualenvs showvirtualenv
complete -F _service /etc/init.d/kerneloops
complete -F _service /etc/init.d/alsa-utils
complete -F _service /etc/init.d/ufw
complete -F _longopt ld
complete -F _service /etc/init.d/apparmor
complete -F _fancygit fancygit
complete -F _longopt enscript
complete -F _command xargs
complete -j -P '"%' -S '"' jobs
complete -F _service service
complete -F _longopt tail
complete -F _longopt unexpand
complete -F _longopt netstat
complete -o nospace -S '/' -F _cdsitepackages_complete cdsitepackages
complete -F _longopt ls
complete -o nospace -F _cd pushd
complete -v unset
complete -F _service /etc/init.d/ipmi_port
complete -o default -o nospace -F _virtualenvs rmvirtualenv
complete -F _longopt csplit
complete -F _known_hosts rsh
complete -F _command exec
complete -F _longopt sum
complete -F _longopt nm
complete -F _longopt nl
complete -F _user_at_host ytalk
complete -F _ksi_completions kitty
complete -u sux
complete -F _longopt paste
complete -F _service /etc/init.d/grub-common
complete -F _longopt dir
complete -F _longopt a2ps
complete -F _root_command really
complete -F _service /etc/init.d/anacron
complete -F _known_hosts dig
complete -F _user_at_host talk
complete -F _service /etc/init.d/keyboard-setup.sh
complete -F _longopt df
complete -F _command eval
complete -F _longopt chroot
complete -F _command do
complete -F _service /etc/init.d/dbus
complete -F _service /etc/init.d/saned
complete -F _longopt du
complete -F _longopt wc
complete -F _service /etc/init.d/openipmi
complete -A shopt shopt
complete -F _known_hosts ftp
complete -F _longopt uname
complete -o default -o nospace -F _virtualenvs workon
complete -F _known_hosts rlogin
complete -F _longopt sha384sum
complete -F _longopt rm
complete -F _service /etc/init.d/cryptdisks
complete -F _root_command gksudo
complete -F _command nice
complete -F _longopt tr
complete -F _longopt sha256sum
complete -F _root_command gksu
complete -F _service /etc/init.d/unattended-upgrades
complete -F _longopt ptx
complete -F _known_hosts traceroute
complete -j -P '"%' -S '"' fg
complete -F _longopt who
complete -F _longopt less
complete -F _longopt mknod
complete -F _command padsp
complete -F _service /etc/init.d/console-setup.sh
complete -F _longopt bison
complete -F _service /etc/init.d/sssd
complete -F _longopt od
complete -F _service /etc/init.d/rpcbind
complete -F _service /etc/init.d/kmod
complete -F _service /etc/init.d/gdm3
complete -F _service /etc/init.d/ipmiutil_evt
complete -F _completion_loader -D
complete -F _longopt split
complete -F _ksi_completions kitten
complete -F _longopt fold
complete -F _known_hosts mtr
complete -F _user_at_host finger
complete -F _service /etc/init.d/apport
complete -F _root_command kdesudo
complete -u w
complete -o default -F __start_vhs vhs
complete -F _longopt irb
complete -F _command tsocks
complete -F _minimal c
complete -F _longopt diff
complete -F _service /etc/init.d/openvpn
complete -F _service /etc/init.d/whoopsie
complete -F _longopt shar
complete -F _longopt vdir
complete -F _service /etc/init.d/plymouth-log
complete -j -P '"%' -S '"' disown
complete -F _longopt bash
complete -F _service /etc/init.d/procps
complete -F _longopt md5sum
complete -A stopped -P '"%' -S '"' bg
complete -F _longopt objcopy
complete -F _longopt bc
complete -F _service /etc/init.d/sysstat
complete -b builtin
complete -F _longopt shasum
complete -F _command ltrace
complete -F _service /etc/init.d/ssh
complete -F _known_hosts traceroute6
complete -F _longopt date
complete -F _longopt cat
complete -F _longopt readelf
complete -F _longopt awk
complete -F _longopt sha512sum
complete -F _longopt seq
complete -F _longopt mkdir
complete -F _longopt sha224sum
complete -F _service /etc/init.d/speech-dispatcher
complete -A helptopic help
complete -F _minimal ''
complete -A setopt set
complete -F _longopt sort
complete -F _longopt pr
complete -F _longopt colordiff
complete -F _longopt fmt
complete -F _service /etc/init.d/bluetooth
complete -F _longopt sed
complete -F _service /etc/init.d/spice-vdagent
complete -F _longopt gperf
complete -F _command time
complete -F _root_command fakeroot
complete -u slay
complete -F _longopt grub
complete -F _service /etc/init.d/cron
complete -F _longopt rmdir
complete -F _service /etc/init.d/uuidd
complete -o nospace -S '/' -F _cdvirtualenv_complete cdvirtualenv
complete -F _service /etc/init.d/ipmiutil_asy
complete -F _longopt units
complete -F _longopt touch
complete -F _longopt ldd
complete -F _command then
complete -F _command command
complete -o default -o nospace -F _virtualenvs cpvirtualenv
complete -F _known_hosts fping6 in cli and tests
…e of the word 'completed with' from 'complete with'
@ajzobro ajzobro marked this pull request as ready for review April 13, 2026 17:51
@ajzobro
Copy link
Copy Markdown
Collaborator Author

ajzobro commented Apr 13, 2026

@tang-mm @rene-oromtz ready for another review.

Copy link
Copy Markdown
Contributor

@rene-oromtz rene-oromtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes! Overall this looks good and seems you have been also testing this extensively (nice touch with the video btw!).
I added only a few comments and one consideration regarding "complete" vs "completed". While we should be removing what it seems now unused completed state I will prefer we move that discussion/changes to its own Jira card. There are a lot of occurrences of completed and while most are harmless at least one of them will break the queue-status action.

Comment thread cli/testflinger_cli/__init__.py Outdated
Comment thread cli/testflinger_cli/__init__.py Outdated
Comment thread docs/submit-job.demo.yaml Outdated
Comment thread docs/images/submit-job.mp4
Comment thread cli/testflinger_cli/__init__.py Outdated
Comment thread cli/testflinger_cli/__init__.py Outdated
Comment thread cli/testflinger_cli/__init__.py Outdated
Comment thread cli/testflinger_cli/__init__.py
Comment thread docs/images/submit-job.mp4
Comment thread docs/submit-job.demo.yaml Outdated
Copy link
Copy Markdown
Collaborator Author

@ajzobro ajzobro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple changes requested

ajzobro added 2 commits April 14, 2026 10:44
Co-authored-by: Andy Zobro <241730435+ajzobro@users.noreply.github.com>
rene-oromtz
rene-oromtz previously approved these changes Apr 14, 2026
Copy link
Copy Markdown
Contributor

@rene-oromtz rene-oromtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, LGTM

Copy link
Copy Markdown
Contributor

@tang-mm tang-mm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for considering all the feedback! This is a great addition to have. Excited to see it go live 🚀

@ajzobro ajzobro merged commit 7ec336d into main Apr 15, 2026
17 of 18 checks passed
@ajzobro ajzobro deleted the status-line branch April 15, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants