Opened 8 years ago

Closed 8 years ago

#6082 closed enhancement (fixed)

stem.util.proc testing

Reported by: atagar Owned by: atagar
Priority: Medium Milestone:
Component: Archived/Stem Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


Stem's proc utilities [1] are currently completely untested. Precious little stem's core functionality currently relies on them, but arm and other stem users will likely find them to be useful for gathering basic information about the tor process (cpu/memory usage, uptime, etc) so we should strive to make them reliable.

For unit tests we'll want to mock out the os functions used by the proc module to stress both cases where it should succeed, and failure/edge cases. For an example of the mocking see stem.util.system's unit tests [2].

Integration tests should be easier. For those we simply need to exercise the proc functions against the tor process that we're running against. To get its pid run...

tor_pid = test.runner.get_runner().get_pid()

Each test should check stem.util.proc.is_available() and, if that's False, then skip the test since proc utilities are unavailable on that platform.

After the testing is in place we can made a long-awaited fix for the proc module (described in the bugs section of stem's wiki [3]).

Let me know if you run into any issues or have questions! Don't be shy to ask - it's far better for me to spend a few minutes answering a question that for you to bang your head against a wall for any length of time. :)

Cheers! -Damian


Child Tickets

Change History (4)

comment:1 Changed 8 years ago by atagar

Status: newneeds_review

Hi Erik, hi Megan. I almost forgot that this was your first big stem patch. Are you ok with this patch and your future stem patches being in the public domain? For the reasons behind why see...

I need an ok from each of you on this ticket before I can merge. Thanks! -Damian

PS. Putting ticket into pending review. For people not tracking tor-dev@ the patch is the proc-test branch in Megan's github repo...

comment:2 in reply to:  1 Changed 8 years ago by meganchang

Replying to atagar:

I need an ok from each of you on this ticket before I can merge. Thanks! -Damian

You have my consent, merge away!

comment:3 in reply to:  1 Changed 8 years ago by ErikI

I need an ok from each of you on this ticket before I can merge. Thanks! -Damian

I agree to the placement of this and future code contributions I make to the Tor project (and specifically, stem) in the public domain.

comment:4 Changed 8 years ago by atagar

Resolution: fixed
Status: needs_reviewclosed
Note: See TracTickets for help on using tickets.