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:
Tomas Hozza 2021-06-30 12:20:36 +02:00 committed by Ondřej Budai
parent 92719e05a2
commit 5e97dcf2b3
2 changed files with 12 additions and 0 deletions

View file

@ -87,6 +87,8 @@ func (stage *Stage) UnmarshalJSON(data []byte) error {
options = new(TimezoneStageOptions)
case "org.osbuild.chrony":
options = new(ChronyStageOptions)
case "org.osbuild.dracut":
options = new(DracutStageOptions)
case "org.osbuild.dracut.conf":
options = new(DracutConfStageOptions)
case "org.osbuild.keymap":

View file

@ -62,6 +62,16 @@ func TestStage_UnmarshalJSON(t *testing.T) {
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",
fields: fields{