Test failure on Alpine Linux x86 and ppc64le #339

Closed
opened 2020-07-03 15:47:31 +00:00 by Bridouz · 3 comments

What I'm trying to do and why

I'm packaging latest version for Alpine Linux. Build is OK, Tests pass too, except for x86 and ppc64le.

The failing test is: test_log_outputs_kills_other_processes_when_one_errors

Logs say:

 ____________ test_log_outputs_kills_other_processes_when_one_errors ____________
     def test_log_outputs_kills_other_processes_when_one_errors():
         flexmock(module.logger).should_receive('log')
         flexmock(module).should_receive('exit_code_indicates_error').and_return(True)
         flexmock(module).should_receive('command_for_process').and_return('grep')
     
         process = subprocess.Popen(['grep'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
         other_process = subprocess.Popen(
             ['watch', 'true'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
         )
         flexmock(module).should_receive('output_buffer_for_process').with_args(process, ()).and_return(
             process.stdout
         )
         flexmock(module).should_receive('output_buffer_for_process').with_args(
             other_process, ()
         ).and_return(other_process.stdout)
         flexmock(other_process).should_receive('kill').once()
     
         with pytest.raises(subprocess.CalledProcessError) as error:
             module.log_outputs(
                 (process, other_process),
                 exclude_stdouts=(),
                 output_log_level=logging.INFO,
                 borg_local_path='borg',
             )
     
 >       assert error.value.returncode == 2
 E       AssertionError: assert None == 2
 E        +  where None = CalledProcessError(None, 'grep', '').returncode
 E        +    where CalledProcessError(None, 'grep', '') = <ExceptionInfo CalledProcessError(None, 'grep', '') tblen=2>.value
 tests/integration/test_execute.py:114: AssertionError

Other notes / implementation ideas

Full build log : https://gitlab.alpinelinux.org/Bridouz/aports/pipelines/26231

Environment

borgmatic version: [1.6]

borgmatic installation method: [Alpine Package]

Borg version: [1.1.13]

Python version: [3.8.3]

operating system and version: [Alpine Linux]

#### What I'm trying to do and why I'm packaging latest version for Alpine Linux. Build is OK, Tests pass too, except for `x86` and `ppc64le`. The failing test is: `test_log_outputs_kills_other_processes_when_one_errors` Logs say: ```=================================== FAILURES =================================== ____________ test_log_outputs_kills_other_processes_when_one_errors ____________ def test_log_outputs_kills_other_processes_when_one_errors(): flexmock(module.logger).should_receive('log') flexmock(module).should_receive('exit_code_indicates_error').and_return(True) flexmock(module).should_receive('command_for_process').and_return('grep') process = subprocess.Popen(['grep'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) other_process = subprocess.Popen( ['watch', 'true'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) flexmock(module).should_receive('output_buffer_for_process').with_args(process, ()).and_return( process.stdout ) flexmock(module).should_receive('output_buffer_for_process').with_args( other_process, () ).and_return(other_process.stdout) flexmock(other_process).should_receive('kill').once() with pytest.raises(subprocess.CalledProcessError) as error: module.log_outputs( (process, other_process), exclude_stdouts=(), output_log_level=logging.INFO, borg_local_path='borg', ) > assert error.value.returncode == 2 E AssertionError: assert None == 2 E + where None = CalledProcessError(None, 'grep', '').returncode E + where CalledProcessError(None, 'grep', '') = <ExceptionInfo CalledProcessError(None, 'grep', '') tblen=2>.value tests/integration/test_execute.py:114: AssertionError ``` #### Other notes / implementation ideas Full build log : <https://gitlab.alpinelinux.org/Bridouz/aports/pipelines/26231> #### Environment **borgmatic version:** [1.6] **borgmatic installation method:** [Alpine Package] **Borg version:** [1.1.13] **Python version:** [3.8.3] **operating system and version:** [Alpine Linux]
Owner

Thank you for bringing this up.. I've seen similiar but not 100% reproducible test failures, especially on older versions of Python. I see this is on Python 3.8 though. And it happens on Alpine Edge?

I'll look into this!

Thank you for bringing this up.. I've seen similiar but not 100% reproducible test failures, especially on older versions of Python. I see this is on Python 3.8 though. And it happens on Alpine Edge? I'll look into this!
witten added the
bug
label 2020-07-04 02:03:59 +00:00
Owner

Well, I never found a reliable repro locally. But I was able to fix a similar test error on the build server, so I'm hoping that fixes the problem for you as well. If it was the problem I suspect, it was a time-of-check / time-of-use issue with a race condition aspect. (Not in the test code, but in the function under test.)

The fix is in master, and it'll be part of the next release. I'll note here when that happens.

Well, I never found a reliable repro locally. But I was able to fix a similar test error on the build server, so I'm hoping that fixes the problem for you as well. If it was the problem I suspect, it was a time-of-check / time-of-use issue with a race condition aspect. (Not in the test code, but in the function under test.) The fix is in master, and it'll be part of the next release. I'll note here when that happens.
Author

Thanks,

Build is passing now.

Thanks, Build is passing now.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#339
No description provided.