Merge lp:~seb128/ubuntu-test-cases/desktop-localized-tests into lp:ubuntu-test-cases/desktop

Proposed by Sebastien Bacher
Status: Merged
Merged at revision: 68
Proposed branch: lp:~seb128/ubuntu-test-cases/desktop-localized-tests
Merge into: lp:ubuntu-test-cases/desktop
Diff against target: 124 lines (+96/-0)
5 files modified
preseeds/default_localized.yaml (+22/-0)
runlists/default_localized.run (+9/-0)
testsuites/usit/system_localized/tc_control (+9/-0)
testsuites/usit/system_localized/test.py (+55/-0)
testsuites/usit/tslist.run (+1/-0)
To merge this branch: bzr merge lp:~seb128/ubuntu-test-cases/desktop-localized-tests
Reviewer Review Type Date Requested Status
Paride Legovini Approve
Review via email: mp+441234@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paride Legovini (paride) wrote :

I didn't test this, but it looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'preseeds/default_localized.yaml'
2--- preseeds/default_localized.yaml 1970-01-01 00:00:00 +0000
3+++ preseeds/default_localized.yaml 2023-04-17 16:09:31 +0000
4@@ -0,0 +1,22 @@
5+identity:
6+ hostname: utah-hostname
7+ password: "$y$j9T$nSo5WE2iVRpZQTf1zdNMA1$aFwGMR.afMfV2ouu9tTfP5.r81iCVcBjIa2chzWIYc7"
8+ username: utah
9+packages:
10+ - openssh-server
11+ - python3-yaml
12+ - bzr
13+ - git
14+ - gdebi-core
15+ - python3-psutil
16+early-commands:
17+ - chmod 666 /dev/ttyS0
18+ - echo "AutoLoginUser=utah" > /tmp/ubuntu_desktop_installer.conf
19+late-commands:
20+ - sh /utah-latecommand
21+ - curtin in-target -- sh /etc/utah/autorun/01_utah-setup
22+locale: fr_FR.UTF-8
23+timezone: US/Eastern
24+source:
25+ id: ubuntu-desktop
26+version: 1
27
28=== added file 'runlists/default_localized.run'
29--- runlists/default_localized.run 1970-01-01 00:00:00 +0000
30+++ runlists/default_localized.run 2023-04-17 16:09:31 +0000
31@@ -0,0 +1,9 @@
32+testsuites:
33+ - name: usit
34+ fetch_method: bzr-export
35+ fetch_location: https://code.launchpad.net/ubuntu-test-cases/desktop/testsuites/usit
36+ include_tests:
37+ - read_write
38+ - dbus_machine_id
39+ - archive_location
40+ - system_localized
41
42=== added directory 'testsuites/usit/system_localized'
43=== added file 'testsuites/usit/system_localized/tc_control'
44--- testsuites/usit/system_localized/tc_control 1970-01-01 00:00:00 +0000
45+++ testsuites/usit/system_localized/tc_control 2023-04-17 16:09:31 +0000
46@@ -0,0 +1,9 @@
47+description: Target system should use the right locale and timezone
48+dependencies: none
49+action: |
50+ 1. Check that the timezone and the LANG env value
51+expected_results: |
52+ 1. The values should match those from the preseeding
53+type: userland
54+command: ./test.py
55+run_as: utah
56
57=== added file 'testsuites/usit/system_localized/test.py'
58--- testsuites/usit/system_localized/test.py 1970-01-01 00:00:00 +0000
59+++ testsuites/usit/system_localized/test.py 2023-04-17 16:09:31 +0000
60@@ -0,0 +1,55 @@
61+#!/usr/bin/python3
62+#
63+# Copyright (C) 2023, Canonical Ltd (http://www.canonical.com/)
64+#
65+# This file is part of ubuntu-test-cases.
66+#
67+# ubuntu-test-cases is free software: you can redistribute it
68+# and/or modify it under the terms of the GNU General Public License
69+# as published by the Free Software Foundation, either version 3 of
70+# the License, or (at your option) any later version.
71+#
72+# ubuntu-test-cases is distributed in the hope that it will
73+# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
74+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
75+# GNU General Public License for more details.
76+#
77+# You should have received a copy of the GNU General Public License
78+# along with ubuntu-test-cases. If not, see
79+# <http://www.gnu.org/licenses/>.
80+
81+"""Target system should use the right locale and timezone"""
82+
83+import logging
84+import os
85+import unittest
86+
87+
88+class SystemLocalizedTest(unittest.TestCase):
89+ TIMEZONE_FILE = '/etc/timezone'
90+ RIGHT_TIMEZONE = 'US/Eastern'
91+ RIGHT_LANG = 'fr_FR.UTF-8'
92+
93+ def test_system_localized(self):
94+ """Test timezone settings."""
95+ logging.info('Reading {!r} file...'.format(self.TIMEZONE_FILE))
96+ with open(self.TIMEZONE_FILE) as f:
97+ timezone = f.read().rstrip()
98+
99+ logging.info('Checking that timezone is ({!r})'
100+ .format(self.RIGHT_TIMEZONE))
101+ self.assertEqual(timezone, self.RIGHT_TIMEZONE,
102+ 'Timezone not matching what expected')
103+
104+ """Test locale settings."""
105+ logging.info('Getting system locale')
106+ lang = os.getenv('LANG')
107+ logging.info('Checking that LANG is ({!r})'
108+ .format(self.RIGHT_LANG))
109+ self.assertEqual(lang, self.RIGHT_LANG,
110+ 'LANG not matching what expected')
111+
112+if __name__ == '__main__':
113+ logging.basicConfig(level=logging.DEBUG,
114+ format='%(levelname)s: %(message)s')
115+ unittest.main()
116
117=== modified file 'testsuites/usit/tslist.run'
118--- testsuites/usit/tslist.run 2013-01-18 17:52:04 +0000
119+++ testsuites/usit/tslist.run 2023-04-17 16:09:31 +0000
120@@ -12,3 +12,4 @@
121 - test: disk_not_full
122 - test: out_of_memory
123 - test: archive_location
124+- test: system_localized

Subscribers

People subscribed via source and target branches