Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • lava lava
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 95
    • Issues 95
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 58
    • Merge requests 58
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • lava
  • lavalava
  • Merge requests
  • !2048

Open
Created Mar 22, 2023 by Igor Ponomarev@igo95862Contributor
  • Report abuse
Report abuse

tests: Fix unclosed file warnings when testing reading logs

  • Overview 8
  • Commits 1
  • Changes 2

The issue was FileResponce was not handled properly. It was simply discarded instead of reading from it.

Now the data is properly red from FileResponce and it properly closes once all data has been red.

Also remove the using .open() on ElasticSearch and MongoDB logs as .open() is hacked on top of .read() for those logs backends.

Before:

tests/lava_rest_app/test_api.py::TestRestApi::test_testjob_logs_offset_end
  /usr/lib/python3/dist-packages/django/db/models/sql/query.py:895: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/pytest-of-root/pytest-1/test_testjob_logs0/output.yaml'>
Edited Mar 27, 2023 by Igor Ponomarev
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: fix-unclosed-files-in-logs