@@ -93,3 +93,47 @@ func TestStepCreateImage_setsDeprecationFields(t *testing.T) {
9393 assert .Equal (t , c .DeleteAt , d .DeprecatedImageStatus .Deleted , "DeleteAt mismatch" )
9494 assert .Contains (t , []string {"DEPRECATED" , "ACTIVE" }, d .DeprecatedImageStatus .State , "State should be DEPRECATED or ACTIVE" )
9595}
96+
97+ func TestStepCreateImageNonUEFI_image (t * testing.T ) {
98+ state := testState (t )
99+ step := new (StepCreateImage )
100+ defer step .Cleanup (state )
101+
102+ c := state .Get ("config" ).(* Config )
103+ c .ImageGuestOsFeatures = []string {}
104+
105+ // run the step
106+ action := step .Run (context .Background (), state )
107+ assert .Equal (t , action , multistep .ActionContinue , "Step did not pass." )
108+
109+ uncastImage , ok := state .GetOk ("image" )
110+ assert .True (t , ok , "State does not have resulting image." )
111+ image , ok := uncastImage .(* common.Image )
112+ assert .True (t , ok , "Image in state is not an Image." )
113+
114+ assert .Len (t , image .ShieldedInstanceInitialState .Keks , 1 )
115+ assert .Len (t , image .ShieldedInstanceInitialState .Dbs , 1 )
116+ assert .Len (t , image .ShieldedInstanceInitialState .Dbxs , 1 )
117+ }
118+
119+ func TestStepCreateImageUEFI_image (t * testing.T ) {
120+ state := testState (t )
121+ step := new (StepCreateImage )
122+ defer step .Cleanup (state )
123+
124+ c := state .Get ("config" ).(* Config )
125+ c .ImageGuestOsFeatures = []string {"UEFI_COMPATIBLE" }
126+
127+ // run the step
128+ action := step .Run (context .Background (), state )
129+ assert .Equal (t , action , multistep .ActionContinue , "Step did not pass." )
130+
131+ uncastImage , ok := state .GetOk ("image" )
132+ assert .True (t , ok , "State does not have resulting image." )
133+ image , ok := uncastImage .(* common.Image )
134+ assert .True (t , ok , "Image in state is not an Image." )
135+
136+ assert .Len (t , image .ShieldedInstanceInitialState .Keks , 1 )
137+ assert .Len (t , image .ShieldedInstanceInitialState .Dbs , 1 )
138+ assert .Len (t , image .ShieldedInstanceInitialState .Dbxs , 1 )
139+ }
0 commit comments