diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2022-06-30 11:15:04 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2022-06-30 11:15:18 +0200 |
commit | af447c493c67df2e4a81b60d4819fea9cd6c6853 (patch) | |
tree | 12cfb6499417511ecf36a9ca9c792dbad649f173 | |
parent | 78cd45f1b56ca5996881f9b91c6fb38679fe2c6d (diff) | |
parent | 9a70d4e819da75481770b7f1bf2c9e295f662534 (diff) | |
download | NetworkManager-af447c493c67df2e4a81b60d4819fea9cd6c6853.tar.gz |
merge: branch 'lr/client-ask-mode'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1282
-rw-r--r-- | .gitlab-ci.yml | 10 | ||||
-rwxr-xr-x | contrib/alpine/REQUIRED_PACKAGES | 1 | ||||
-rwxr-xr-x | contrib/debian/REQUIRED_PACKAGES | 1 | ||||
-rwxr-xr-x | contrib/fedora/REQUIRED_PACKAGES | 1 | ||||
-rwxr-xr-x | src/tests/client/test-client.py | 92 |
5 files changed, 76 insertions, 29 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc3b9488f9..b321b9a3a6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,11 +48,11 @@ variables: # # This is done by running `ci-fairy generate-template` and possibly bumping # ".default_tag". - FEDORA_TAG: '2022-06-27.0-8441692e0ce9' - UBUNTU_TAG: '2022-06-27.0-d5ae0b779ff0' - DEBIAN_TAG: '2022-06-27.0-d5ae0b779ff0' - CENTOS_TAG: '2022-06-27.0-8441692e0ce9' - ALPINE_TAG: '2022-06-27.0-be0e42c19eb0' + FEDORA_TAG: '2022-06-27.0-2c10e7aed898' + UBUNTU_TAG: '2022-06-27.0-03a416b036a0' + DEBIAN_TAG: '2022-06-27.0-03a416b036a0' + CENTOS_TAG: '2022-06-27.0-2c10e7aed898' + ALPINE_TAG: '2022-06-27.0-72578ddac08c' FEDORA_EXEC: 'bash .gitlab-ci/fedora-install.sh' UBUNTU_EXEC: 'bash .gitlab-ci/debian-install.sh' diff --git a/contrib/alpine/REQUIRED_PACKAGES b/contrib/alpine/REQUIRED_PACKAGES index 9e2fd779fd..1b299b2e44 100755 --- a/contrib/alpine/REQUIRED_PACKAGES +++ b/contrib/alpine/REQUIRED_PACKAGES @@ -44,6 +44,7 @@ apk add \ 'ppp-dev' \ 'py3-dbus' \ 'py3-gobject3' \ + 'py3-pexpect' \ 'python3' \ 'readline-dev' \ 'util-linux-dev' \ diff --git a/contrib/debian/REQUIRED_PACKAGES b/contrib/debian/REQUIRED_PACKAGES index 5983cbc741..1703d2e166 100755 --- a/contrib/debian/REQUIRED_PACKAGES +++ b/contrib/debian/REQUIRED_PACKAGES @@ -75,6 +75,7 @@ install \ python3-gi \ python3-pip \ python3-setuptools \ + python3-pexpect \ udev \ uuid-dev \ valgrind \ diff --git a/contrib/fedora/REQUIRED_PACKAGES b/contrib/fedora/REQUIRED_PACKAGES index 637d47e979..2f80c549fe 100755 --- a/contrib/fedora/REQUIRED_PACKAGES +++ b/contrib/fedora/REQUIRED_PACKAGES @@ -75,6 +75,7 @@ install \ ppp-devel \ python3-dbus \ python3-gobject \ + python3-pexpect \ readline-devel \ rpm-build \ systemd-devel \ diff --git a/src/tests/client/test-client.py b/src/tests/client/test-client.py index f322a94def..6b2c51f526 100755 --- a/src/tests/client/test-client.py +++ b/src/tests/client/test-client.py @@ -120,6 +120,7 @@ import random import dbus.service import dbus.mainloop.glib import io +import pexpect ############################################################################### @@ -837,6 +838,47 @@ class TestNmcli(NmTestBase): frame, ) + def call_nmcli_pexpect(self, args): + env = self._env() + return pexpect.spawn( + conf.get(ENV_NM_TEST_CLIENT_NMCLI_PATH), args, timeout=5, env=env + ) + + def _env( + self, lang="C", calling_num=None, fatal_warnings=_DEFAULT_ARG, extra_env=None + ): + if lang == "C": + language = "" + elif lang == "de_DE.utf8": + language = "de" + elif lang == "pl_PL.UTF-8": + language = "pl" + else: + self.fail("invalid language %s" % (lang)) + + env = {} + for k in ["LD_LIBRARY_PATH", "DBUS_SESSION_BUS_ADDRESS"]: + val = os.environ.get(k, None) + if val is not None: + env[k] = val + env["LANG"] = lang + env["LANGUAGE"] = language + env["LIBNM_USE_SESSION_BUS"] = "1" + env["LIBNM_USE_NO_UDEV"] = "1" + env["TERM"] = "linux" + env["ASAN_OPTIONS"] = conf.get(ENV_NM_TEST_ASAN_OPTIONS) + env["LSAN_OPTIONS"] = conf.get(ENV_NM_TEST_LSAN_OPTIONS) + env["LBSAN_OPTIONS"] = conf.get(ENV_NM_TEST_UBSAN_OPTIONS) + env["XDG_CONFIG_HOME"] = PathConfiguration.srcdir() + if calling_num is not None: + env["NM_TEST_CALLING_NUM"] = str(calling_num) + if fatal_warnings is _DEFAULT_ARG or fatal_warnings: + env["G_DEBUG"] = "fatal-warnings" + if extra_env is not None: + for k, v in extra_env.items(): + env[k] = v + return env + def _call_nmcli( self, args, @@ -889,37 +931,13 @@ class TestNmcli(NmTestBase): if lang is None or lang == "C": lang = "C" - language = "" elif lang == "de": lang = "de_DE.utf8" - language = "de" elif lang == "pl": lang = "pl_PL.UTF-8" - language = "pl" else: self.fail("invalid language %s" % (lang)) - env = {} - for k in ["LD_LIBRARY_PATH", "DBUS_SESSION_BUS_ADDRESS"]: - val = os.environ.get(k, None) - if val is not None: - env[k] = val - env["LANG"] = lang - env["LANGUAGE"] = language - env["LIBNM_USE_SESSION_BUS"] = "1" - env["LIBNM_USE_NO_UDEV"] = "1" - env["TERM"] = "linux" - env["ASAN_OPTIONS"] = conf.get(ENV_NM_TEST_ASAN_OPTIONS) - env["LSAN_OPTIONS"] = conf.get(ENV_NM_TEST_LSAN_OPTIONS) - env["LBSAN_OPTIONS"] = conf.get(ENV_NM_TEST_UBSAN_OPTIONS) - env["XDG_CONFIG_HOME"] = PathConfiguration.srcdir() - env["NM_TEST_CALLING_NUM"] = str(calling_num) - if fatal_warnings is _DEFAULT_ARG or fatal_warnings: - env["G_DEBUG"] = "fatal-warnings" - if extra_env is not None: - for k, v in extra_env.items(): - env[k] = v - args = [conf.get(ENV_NM_TEST_CLIENT_NMCLI_PATH)] + list(args) if replace_stdout is not None: @@ -1030,6 +1048,7 @@ class TestNmcli(NmTestBase): "content": content, } + env = self._env(lang, calling_num, fatal_warnings, extra_env) async_job = AsyncProcess(args=args, env=env, complete_cb=complete_cb) self._async_jobs.append(async_job) @@ -1088,6 +1107,9 @@ class TestNmcli(NmTestBase): results = self._results self._results = None + if len(results) == 0: + return + skip_test_for_l10n_diff = self._skip_test_for_l10n_diff self._skip_test_for_l10n_diff = None @@ -1820,6 +1842,28 @@ class TestNmcli(NmTestBase): extra_env=no_dbus_env, ) + @nm_test + def test_ask_mode(self): + nmc = self.call_nmcli_pexpect(["--ask", "c", "add"]) + nmc.expect("Connection type:") + nmc.sendline("ethernet") + nmc.expect("Interface name:") + nmc.sendline("eth0") + nmc.expect("There are 3 optional settings for Wired Ethernet.") + nmc.expect("Do you want to provide them\? \(yes/no\) \[yes]") + nmc.sendline("no") + nmc.expect("There are 2 optional settings for IPv4 protocol.") + nmc.expect("Do you want to provide them\? \(yes/no\) \[yes]") + nmc.sendline("no") + nmc.expect("There are 2 optional settings for IPv6 protocol.") + nmc.expect("Do you want to provide them\? \(yes/no\) \[yes]") + nmc.sendline("no") + nmc.expect("There are 4 optional settings for Proxy.") + nmc.expect("Do you want to provide them\? \(yes/no\) \[yes]") + nmc.sendline("no") + nmc.expect("Connection 'ethernet' \(.*\) successfully added.") + nmc.expect(pexpect.EOF) + ############################################################################### |