Skip to content

Commit

Permalink
tests: Add autopkgtest for LP#1959570
Browse files Browse the repository at this point in the history
  • Loading branch information
slyon committed Oct 30, 2023
1 parent 1aa0974 commit 3fa7e4d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/integration/regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,33 @@ def test_apply_networkd_inactive_lp1962095(self):
class TestNetworkManager(IntegrationTestsBase, _CommonTests):
backend = 'NetworkManager'

def test_try_accept_lp1959570(self):
original_env = dict(os.environ)
self.addCleanup(subprocess.call, ['ip', 'link', 'delete', 'br54'], stderr=subprocess.DEVNULL)
self.addCleanup(subprocess.call, ['mv', '/snap/bin/nmcli', '/usr/bin/nmcli'], stderr=subprocess.DEVNULL)
self.addCleanup(os.environ.update, original_env)
os.makedirs('/snap/bin', exist_ok=True)
subprocess.call(['mv', '/usr/bin/nmcli', '/snap/bin/nmcli'])
with open(self.config, 'w') as f:
f.write('''network:
renderer: %(r)s
version: 2
bridges:
br54:
addresses:
- "10.0.0.20/24"''' % {'r': self.backend})
os.chmod(self.config, mode=0o600)
del os.environ['PATH'] # clear PATH, to test for LP: #1959570
p = subprocess.Popen(['/usr/sbin/netplan', 'try'], bufsize=1, text=True,
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
time.sleep(2)
p.send_signal(signal.SIGUSR1)
out, err = p.communicate(timeout=10)
os.environ = original_env
self.assertEqual('', err)
self.assertNotIn('An error occurred:', out)
self.assertIn('Configuration accepted.', out)


class TestDbus(IntegrationTestsBase):
# This test can be dropped when tests/integration/dbus.py is
Expand Down

0 comments on commit 3fa7e4d

Please sign in to comment.