osbuild2: add missing JSON unmarshaling test for org.osbuild.dracut stage
The `org.osbuild.dracut` stage was previously not tested for JSON unmarshalling. Add the missing test case and extend Stage's `UnmarshalJSON()` method. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
92719e05a2
commit
5e97dcf2b3
2 changed files with 12 additions and 0 deletions
|
|
@ -87,6 +87,8 @@ func (stage *Stage) UnmarshalJSON(data []byte) error {
|
||||||
options = new(TimezoneStageOptions)
|
options = new(TimezoneStageOptions)
|
||||||
case "org.osbuild.chrony":
|
case "org.osbuild.chrony":
|
||||||
options = new(ChronyStageOptions)
|
options = new(ChronyStageOptions)
|
||||||
|
case "org.osbuild.dracut":
|
||||||
|
options = new(DracutStageOptions)
|
||||||
case "org.osbuild.dracut.conf":
|
case "org.osbuild.dracut.conf":
|
||||||
options = new(DracutConfStageOptions)
|
options = new(DracutConfStageOptions)
|
||||||
case "org.osbuild.keymap":
|
case "org.osbuild.keymap":
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,16 @@ func TestStage_UnmarshalJSON(t *testing.T) {
|
||||||
data: []byte(`{"type":"org.osbuild.chrony","options":{"timeservers":null}}`),
|
data: []byte(`{"type":"org.osbuild.chrony","options":{"timeservers":null}}`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "dracut",
|
||||||
|
fields: fields{
|
||||||
|
Type: "org.osbuild.dracut",
|
||||||
|
Options: &DracutStageOptions{},
|
||||||
|
},
|
||||||
|
args: args{
|
||||||
|
data: []byte(`{"type":"org.osbuild.dracut","options":{"kernel":null}}`),
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "dracut.conf",
|
name: "dracut.conf",
|
||||||
fields: fields{
|
fields: fields{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue