Merge pull request #1084 from canonical/wsl_oobe_conf_calls_tests
DEENG-82 - Compare in runtest.sh the configuration set to `.subiquity/wsl.conf` and other generated files.
This commit is contained in:
commit
031256c771
|
@ -0,0 +1,18 @@
|
|||
WSLConfigurationBase:
|
||||
automount_root: '/custom_mnt_path'
|
||||
automount_options: 'metadata'
|
||||
network_generatehosts: false
|
||||
network_generateresolvconf: false
|
||||
WSLConfigurationAdvanced:
|
||||
interop_enabled: false
|
||||
interop_appendwindowspath: false
|
||||
gui_theme: 'light'
|
||||
gui_followwintheme: true
|
||||
interop_guiintegration: true
|
||||
interop_audiointegration: true
|
||||
interop_advancedipdetection: true
|
||||
motd_wslnewsenabled: false
|
||||
automount_enabled: false
|
||||
automount_mountfstab: false
|
||||
Summary:
|
||||
reboot: yes
|
|
@ -14,4 +14,15 @@ wslconfbase:
|
|||
automount_options: 'metadata'
|
||||
network_generatehosts: false
|
||||
network_generateresolvconf: false
|
||||
wslconfadvanced:
|
||||
interop_enabled: false
|
||||
interop_appendwindowspath: false
|
||||
gui_theme: 'light'
|
||||
gui_followwintheme: true
|
||||
interop_guiintegration: true
|
||||
interop_audiointegration: true
|
||||
interop_advancedipdetection: true
|
||||
motd_wslnewsenabled: false
|
||||
automount_enabled: false
|
||||
automount_mountfstab: false
|
||||
shutdown: 'reboot'
|
|
@ -22,8 +22,15 @@ validate () {
|
|||
fi
|
||||
netplan generate --root .subiquity
|
||||
elif [ "${mode}" = "system_setup" ]; then
|
||||
# TODO WSL: Compare generated wsl.conf to oracle
|
||||
echo "system setup validation"
|
||||
setup_mode="$2"
|
||||
echo "system setup validation for $setup_mode"
|
||||
[ -d ".subiquity/etc/" ] || (echo "etc/ dir not created for config"; exit 1)
|
||||
[ -d "system_setup/tests/golden/${setup_mode}" ] || (echo "tests/golden not found in system_setup"; exit 1)
|
||||
for file in system_setup/tests/golden/${setup_mode}/*.conf; do
|
||||
filename=$(basename ${file})
|
||||
conf_filepath=".subiquity/etc/${filename}"
|
||||
diff -Nup "${file}" "${conf_filepath}" || exit 1
|
||||
done
|
||||
else
|
||||
echo "W: Unknown validation mode: ${mode}"
|
||||
fi
|
||||
|
@ -34,6 +41,7 @@ clean () {
|
|||
rm -f .subiquity/subiquity-*.log
|
||||
rm -f "$testschema"
|
||||
rm -rf .subiquity/run/
|
||||
rm -rf .subiquity/etc/*.conf
|
||||
rm -rf .subiquity/etc/cloud/cloud.cfg.d/99-installer.cfg
|
||||
}
|
||||
|
||||
|
@ -66,8 +74,15 @@ for answers in examples/answers*.yaml; do
|
|||
else
|
||||
# The OOBE doesn't exist in WSL < 20.04
|
||||
if [ "${RELEASE%.*}" -ge 20 ]; then
|
||||
timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --answers $answers --dry-run " < $tty
|
||||
validate "system_setup"
|
||||
# check if it is reconf
|
||||
reconf_settings="false"
|
||||
validate_subtype="answers"
|
||||
if echo $answers|grep -q reconf; then
|
||||
reconf_settings="true"
|
||||
validate_subtype="answers-reconf"
|
||||
fi
|
||||
timeout --foreground 60 sh -c "DRYRUN_RECONFIG=$reconf_settings LANG=C.UTF-8 python3 -m system_setup.cmd.tui --answers $answers --dry-run " < $tty
|
||||
validate "system_setup" "$validate_subtype"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
@ -105,6 +120,7 @@ if [ "${RELEASE%.*}" -ge 20 ]; then
|
|||
# Like generating a wsl.conf file and comparing it to the oracle.
|
||||
clean
|
||||
timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --autoinstall examples/autoinstall-system-setup.yaml --dry-run"
|
||||
validate "system_setup" "autoinstall"
|
||||
|
||||
python3 -m system_setup.cmd.schema > "$testschema"
|
||||
scripts/schema-cmp.py "autoinstall-system-setup-schema.json" "$testschema" --ignore-tz
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
# original code from ubuntuwslctl.core.loader
|
||||
# Copyright (C) 2021 Canonical Ltd.
|
||||
|
||||
import collections
|
||||
import os
|
||||
import logging
|
||||
from configparser import ConfigParser
|
||||
|
@ -161,6 +162,16 @@ def wsl_config_update(config_class, root_dir):
|
|||
config.add_section(config_section)
|
||||
config[config_section][config_setting] = config_value
|
||||
|
||||
# sort config in ascii order
|
||||
for section in config._sections:
|
||||
config._sections[section] = \
|
||||
collections.OrderedDict(
|
||||
sorted(config._sections[section].items(),
|
||||
key=lambda t: t[0]))
|
||||
config._sections = \
|
||||
collections.OrderedDict(sorted(config._sections.items(),
|
||||
key=lambda t: t[0]))
|
||||
|
||||
with open(conf_file + ".new", 'w+') as configfile:
|
||||
config.write(configfile)
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
[GUI]
|
||||
followwintheme = true
|
||||
theme = light
|
||||
|
||||
[Interop]
|
||||
advancedipdetection = true
|
||||
audiointegration = true
|
||||
guiintegration = true
|
||||
|
||||
[Motd]
|
||||
wslnewsenabled = false
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
[automount]
|
||||
enabled = false
|
||||
mountfstab = false
|
||||
options = metadata
|
||||
root = /custom_mnt_path
|
||||
|
||||
[interop]
|
||||
appendwindowspath = false
|
||||
enabled = false
|
||||
|
||||
[network]
|
||||
generatehosts = false
|
||||
generateresolvconf = false
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
[automount]
|
||||
options = metadata
|
||||
root = /custom_mnt_path
|
||||
|
||||
[network]
|
||||
generatehosts = false
|
||||
generateresolvconf = false
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
[automount]
|
||||
options = metadata
|
||||
root = /custom_mnt_path
|
||||
|
||||
[network]
|
||||
generatehosts = false
|
||||
generateresolvconf = false
|
||||
|
Loading…
Reference in New Issue