eraser icon indicating copy to clipboard operation
eraser copied to clipboard

feat: upload logs

Open ashnamehrotra opened this issue 2 years ago • 3 comments

What this PR does / why we need it: Uploads manager and collector pod logs for e2e tests. Collector pod logs not included for collector-pipeline test since it deploys using manifest and imagelist-change test since it causes a timeout due to updating imagelist with delay.

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged): Fixes #280

Special notes for your reviewer:

ashnamehrotra avatar Aug 18 '22 22:08 ashnamehrotra

Maybe you can write the logs to a file and have upload as a CI artifact? Should be a bit easier parse that way. Maybe something like TEST_LOGDIR to determine where to write the files and then further namespace that on <package name>/t.Name()/<pod name/manager>?

Also seems like a lot of duplication here. It seems like we could make a util function like:

func CaptureLogs(t *testing.T, c Client, pods []*v1.Pod)

Maybe needs more arguments than that but just to give you an idea.

cpuguy83 avatar Aug 19 '22 16:08 cpuguy83

upload-artifact action that can help to push logs as a CI artifact: https://github.com/actions/upload-artifact

sozercan avatar Aug 19 '22 16:08 sozercan

Codecov Report

Merging #377 (e166ff1) into main (3bf5e63) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #377   +/-   ##
=======================================
  Coverage   21.94%   21.94%           
=======================================
  Files          10       10           
  Lines         606      606           
=======================================
  Hits          133      133           
  Misses        461      461           
  Partials       12       12           
Flag Coverage Δ
unittests 21.94% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Aug 22 '22 18:08 codecov-commenter

Could you also add .txt as a file suffix on these logs? This way when trying to read them the OS knows how to open it.

cpuguy83 avatar Aug 29 '22 23:08 cpuguy83