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
=== added file 'preseeds/default_localized.yaml'
--- preseeds/default_localized.yaml 1970-01-01 00:00:00 +0000
+++ preseeds/default_localized.yaml 2023-04-17 16:09:31 +0000
@@ -0,0 +1,22 @@
1identity:
2 hostname: utah-hostname
3 password: "$y$j9T$nSo5WE2iVRpZQTf1zdNMA1$aFwGMR.afMfV2ouu9tTfP5.r81iCVcBjIa2chzWIYc7"
4 username: utah
5packages:
6 - openssh-server
7 - python3-yaml
8 - bzr
9 - git
10 - gdebi-core
11 - python3-psutil
12early-commands:
13 - chmod 666 /dev/ttyS0
14 - echo "AutoLoginUser=utah" > /tmp/ubuntu_desktop_installer.conf
15late-commands:
16 - sh /utah-latecommand
17 - curtin in-target -- sh /etc/utah/autorun/01_utah-setup
18locale: fr_FR.UTF-8
19timezone: US/Eastern
20source:
21 id: ubuntu-desktop
22version: 1
023
=== added file 'runlists/default_localized.run'
--- runlists/default_localized.run 1970-01-01 00:00:00 +0000
+++ runlists/default_localized.run 2023-04-17 16:09:31 +0000
@@ -0,0 +1,9 @@
1testsuites:
2 - name: usit
3 fetch_method: bzr-export
4 fetch_location: https://code.launchpad.net/ubuntu-test-cases/desktop/testsuites/usit
5 include_tests:
6 - read_write
7 - dbus_machine_id
8 - archive_location
9 - system_localized
010
=== added directory 'testsuites/usit/system_localized'
=== added file 'testsuites/usit/system_localized/tc_control'
--- testsuites/usit/system_localized/tc_control 1970-01-01 00:00:00 +0000
+++ testsuites/usit/system_localized/tc_control 2023-04-17 16:09:31 +0000
@@ -0,0 +1,9 @@
1description: Target system should use the right locale and timezone
2dependencies: none
3action: |
4 1. Check that the timezone and the LANG env value
5expected_results: |
6 1. The values should match those from the preseeding
7type: userland
8command: ./test.py
9run_as: utah
010
=== added file 'testsuites/usit/system_localized/test.py'
--- testsuites/usit/system_localized/test.py 1970-01-01 00:00:00 +0000
+++ testsuites/usit/system_localized/test.py 2023-04-17 16:09:31 +0000
@@ -0,0 +1,55 @@
1#!/usr/bin/python3
2#
3# Copyright (C) 2023, Canonical Ltd (http://www.canonical.com/)
4#
5# This file is part of ubuntu-test-cases.
6#
7# ubuntu-test-cases is free software: you can redistribute it
8# and/or modify it under the terms of the GNU General Public License
9# as published by the Free Software Foundation, either version 3 of
10# the License, or (at your option) any later version.
11#
12# ubuntu-test-cases is distributed in the hope that it will
13# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with ubuntu-test-cases. If not, see
19# <http://www.gnu.org/licenses/>.
20
21"""Target system should use the right locale and timezone"""
22
23import logging
24import os
25import unittest
26
27
28class SystemLocalizedTest(unittest.TestCase):
29 TIMEZONE_FILE = '/etc/timezone'
30 RIGHT_TIMEZONE = 'US/Eastern'
31 RIGHT_LANG = 'fr_FR.UTF-8'
32
33 def test_system_localized(self):
34 """Test timezone settings."""
35 logging.info('Reading {!r} file...'.format(self.TIMEZONE_FILE))
36 with open(self.TIMEZONE_FILE) as f:
37 timezone = f.read().rstrip()
38
39 logging.info('Checking that timezone is ({!r})'
40 .format(self.RIGHT_TIMEZONE))
41 self.assertEqual(timezone, self.RIGHT_TIMEZONE,
42 'Timezone not matching what expected')
43
44 """Test locale settings."""
45 logging.info('Getting system locale')
46 lang = os.getenv('LANG')
47 logging.info('Checking that LANG is ({!r})'
48 .format(self.RIGHT_LANG))
49 self.assertEqual(lang, self.RIGHT_LANG,
50 'LANG not matching what expected')
51
52if __name__ == '__main__':
53 logging.basicConfig(level=logging.DEBUG,
54 format='%(levelname)s: %(message)s')
55 unittest.main()
056
=== modified file 'testsuites/usit/tslist.run'
--- testsuites/usit/tslist.run 2013-01-18 17:52:04 +0000
+++ testsuites/usit/tslist.run 2023-04-17 16:09:31 +0000
@@ -12,3 +12,4 @@
12- test: disk_not_full12- test: disk_not_full
13- test: out_of_memory13- test: out_of_memory
14- test: archive_location14- test: archive_location
15- test: system_localized

Subscribers

People subscribed via source and target branches