google / google/turbinia

Tests aren't hermetic and rely on presence of system configuration file(s)

Open
#446 0 comments 0 reactions 0 assignees View on GitHub
enhancement refactoring testing
Dominant language
Python
Stars
794
Forks
172
PR merge metrics
No merged PRs in 30d

Description

While working through #191, I ran into some issues where non-config tests all fail with "No config files found" exceptions if I removed my ~/.turbiniarc file.

This was due to removing the "fall back" source config references in [my initial change](https://github.com/johngalvin/turbinia/commit/c7392a70fe66f9a60bc45e9642b92a2c45147a71), where it looks like all the tests are implicitly depending on either the running system config, or falling back to the source file turbinia/config/turbinia_config.py.

Going to add the fallback option back in for now, but suspect we want to address the [TODO](https://github.com/google/turbinia/blob/7b49077a843152cd003e1cad05f74c96c1c2546a/turbinia/config/__init__.py#L97) about global config variable to fix it properly.

Chatted with Aaron and not sure of the best path forward to make it hermetic without a lot of duplication due to things like conditional imports based on config values or similar -- filing a bug so we can think about it and figure out the test/config refactoring separately from #191.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failures without ~/.turbiniarc, then inspect turbinia/config/__init__.py and the fallback in turbinia/config/turbinia_config.py. Trace how the non-config tests obtain configuration, including conditional imports, and determine a refactoring that keeps tests independent of system configuration. Done means the tests pass without a user config file or source-tree fallback assumptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.