add test that generated json from autoyast xml is valid#1946
Closed
jreidinger wants to merge 6 commits intomasterfrom
Closed
add test that generated json from autoyast xml is valid#1946jreidinger wants to merge 6 commits intomasterfrom
jreidinger wants to merge 6 commits intomasterfrom
Conversation
…ilename is omitted it will be valid json and fix empty location tag(fix#1903)
6eabbcd to
91bc0c3
Compare
cbd6b5d to
ff6bc66
Compare
imobachgs
reviewed
Jan 30, 2025
Contributor
imobachgs
left a comment
There was a problem hiding this comment.
Just some minor comments. Otherwise, LGTM.
| def read_script(section) | ||
| script = { | ||
| "name" => section["file_name"] | ||
| "name" => section["filename"] || "annonymous#{@anonymous_counter += 1}" |
Contributor
There was a problem hiding this comment.
typo: it should be anonymous but, to be honest, I do not like that prefix that much. I would prefer script-, or unnamed- or something else.
| context "for cloned profile" do | ||
| let(:profile_name) { "cloned.xml" } | ||
|
|
||
| it "generate json according to schema" do |
Contributor
There was a problem hiding this comment.
Suggested change
| it "generate json according to schema" do | |
| it "generate JSON according to schema" do |
| end | ||
| end | ||
|
|
||
| context "for cloned profile" do |
Contributor
There was a problem hiding this comment.
It is just an AutoYaST profile, right? No matter whether it is cloned or written from scratch.
Contributor
imobachgs
added a commit
that referenced
this pull request
Feb 14, 2025
## Problem The conversion of the localization and scripts sections has several problems: - #1903 - #1907 - #1960 This PR include some changes from #1951 and #1946. ## Solution - Fix the handling of the scripts file name and location. - Fix the name of the localization setting ("localization" instead of "l10n"). Additionally, use "pretty" JSON when exporting the converted profile. ## Testing - _Added a new unit test_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
autoinst.xml profile conversion can lead to non valid profile.json
#1960
#1907
#1903
Solution
Add ci test to validate cloned autoyast profile. Fix issue with localization. Fix other autoyast conversion related issues.
Note: sadly I need to add python3-jsonschema to install as rubygem-json-schema does not support anything newer then draft5 json schema and we use newer.
Testing
Output
before pretty generate
{"localization":{"timezone":"America/New_York"},"product":{"id":"SLES"},"root":{"password":"$6$sxZ921ci.szwhCIw$9lrLQTtanJcpPeJkqv9pU0LsKQLO3RcPhBPBDMfc1uGUDCfgiyEyGPNr/ZKXAgqZsL61DANvr4uAYYDkif/Ma0","hashedPassword":true},"software":{"patterns":["apparmor","base","basic_desktop","enhanced_base","minimal_base","x11","x11_yast","yast2_basis"]},"legacyAutoyastStorage":[{"device":"/dev/system","enable_snapshots":true,"partitions":[{"create":true,"filesystem":"xfs","format":false,"lv_name":"home","mount":"/home","mountby":"device","pool":false,"resize":false,"size":"5792333824","stripes":1,"stripesize":0},{"create":true,"create_subvolumes":true,"filesystem":"btrfs","format":false,"lv_name":"root","mount":"/","mountby":"device","pool":false,"quotas":true,"resize":false,"size":"13522436096","stripes":1,"stripesize":0,"subvolumes":[{"copy_on_write":false,"path":"var"},{"copy_on_write":true,"path":"usr/local"},{"copy_on_write":true,"path":"tmp"},{"copy_on_write":true,"path":"srv"},{"copy_on_write":true,"path":"root"},{"copy_on_write":true,"path":"opt"},{"copy_on_write":true,"path":"boot/grub2/x86_64-efi"},{"copy_on_write":true,"path":"boot/grub2/i386-pc"}],"subvolumes_prefix":"@"},{"create":true,"filesystem":"swap","format":false,"lv_name":"swap","mount":"swap","mountby":"device","pool":false,"resize":false,"size":"2147483648","stripes":1,"stripesize":0}],"pesize":"4194304","type":"CT_LVM"},{"device":"/dev/sda","disklabel":"gpt","partitions":[{"create":true,"format":false,"partition_id":263,"partition_nr":1,"resize":false,"size":"8388608"},{"create":true,"format":false,"lvm_group":"system","partition_id":142,"partition_nr":2,"resize":false,"size":"21465382400"}],"type":"CT_DISK","use":"all"}],"user":{"userName":"tux","fullName":"tux","password":"$6$epM6.b193j7ZvUaw$/oMPS9pQR9X9i1MAJag20ZFy0XSI4985uVQDGLugwoCbDJVoXKCWLMFM.WncHr/bpkjecwb.LLaJeheYatq8f.","hashedPassword":true}}after pretty generate
{ "localization": { "timezone": "America/New_York" }, "product": { "id": "SLES" }, "root": { "password": "$6$sxZ921ci.szwhCIw$9lrLQTtanJcpPeJkqv9pU0LsKQLO3RcPhBPBDMfc1uGUDCfgiyEyGPNr/ZKXAgqZsL61DANvr4uAYYDkif/Ma0", "hashedPassword": true }, "software": { "patterns": [ "apparmor", "base", "basic_desktop", "enhanced_base", "minimal_base", "x11", "x11_yast", "yast2_basis" ] }, "legacyAutoyastStorage": [ { "device": "/dev/system", "enable_snapshots": true, "partitions": [ { "create": true, "filesystem": "xfs", "format": false, "lv_name": "home", "mount": "/home", "mountby": "device", "pool": false, "resize": false, "size": "5792333824", "stripes": 1, "stripesize": 0 }, { "create": true, "create_subvolumes": true, "filesystem": "btrfs", "format": false, "lv_name": "root", "mount": "/", "mountby": "device", "pool": false, "quotas": true, "resize": false, "size": "13522436096", "stripes": 1, "stripesize": 0, "subvolumes": [ { "copy_on_write": false, "path": "var" }, { "copy_on_write": true, "path": "usr/local" }, { "copy_on_write": true, "path": "tmp" }, { "copy_on_write": true, "path": "srv" }, { "copy_on_write": true, "path": "root" }, { "copy_on_write": true, "path": "opt" }, { "copy_on_write": true, "path": "boot/grub2/x86_64-efi" }, { "copy_on_write": true, "path": "boot/grub2/i386-pc" } ], "subvolumes_prefix": "@" }, { "create": true, "filesystem": "swap", "format": false, "lv_name": "swap", "mount": "swap", "mountby": "device", "pool": false, "resize": false, "size": "2147483648", "stripes": 1, "stripesize": 0 } ], "pesize": "4194304", "type": "CT_LVM" }, { "device": "/dev/sda", "disklabel": "gpt", "partitions": [ { "create": true, "format": false, "partition_id": 263, "partition_nr": 1, "resize": false, "size": "8388608" }, { "create": true, "format": false, "lvm_group": "system", "partition_id": 142, "partition_nr": 2, "resize": false, "size": "21465382400" } ], "type": "CT_DISK", "use": "all" } ], "user": { "userName": "tux", "fullName": "tux", "password": "$6$epM6.b193j7ZvUaw$/oMPS9pQR9X9i1MAJag20ZFy0XSI4985uVQDGLugwoCbDJVoXKCWLMFM.WncHr/bpkjecwb.LLaJeheYatq8f.", "hashedPassword": true } }