Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yasminvalim committed Nov 21, 2024
1 parent b4708fa commit bb89cfa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2906,17 +2906,20 @@ func TestTranslate3_5to3_4(t *testing.T) {
t.Fatalf("Failed translation: %v", err)
}

res, err := v35tov34.Translate(nonexhaustiveConfig3_4)
res, err := v35tov34.Translate(nonexhaustiveConfig3_5)
if err != nil {
t.Fatalf("Failed translation: %v", err)
}
assert.Equal(t, downtranslateConfig3_3, res)
assert.Equal(t, downtranslateConfig3_4, res)

// Translation with unsupported `Cex` type
_, err = v35tov34.Translate(types3_5.Config{
Ignition: types3_5.Ignition{
Version: "3.5.0",
},
Cex: types3_5.Cex{

Check failure on line 2920 in translate_test.go

View workflow job for this annotation

GitHub Actions / Test (1.18.x)

unknown field 'Cex' in struct literal of type "github.com/coreos/ignition/v2/config/v3_5/types".Config

Check failure on line 2920 in translate_test.go

View workflow job for this annotation

GitHub Actions / Test (1.19.x)

unknown field 'Cex' in struct literal of type "github.com/coreos/ignition/v2/config/v3_5/types".Config

Check failure on line 2920 in translate_test.go

View workflow job for this annotation

GitHub Actions / Test (1.20.x)

unknown field Cex in struct literal of type "github.com/coreos/ignition/v2/config/v3_5/types".Config
Enabled: util.BoolP(true),
},
})
assert.Error(t, err)
assert.ErrorContains(t, err, "'Cex' type is not supported in spec v3.4")
Expand Down

0 comments on commit bb89cfa

Please sign in to comment.