@@ -1105,6 +1105,13 @@ func TestUpdateVMMetadata_Isolated(t *testing.T) {
1105
1105
assert .Equalf (t , "45" , stdout , "container %q did not emit expected stdout" , containerName )
1106
1106
}
1107
1107
1108
+ func exitCode (err * exec.ExitError ) int {
1109
+ if status , ok := err .Sys ().(syscall.WaitStatus ); ok {
1110
+ return int (status )
1111
+ }
1112
+ return - 1
1113
+ }
1114
+
1108
1115
// TestRandomness validates that there is a reasonable amount of entropy available to the VM and thus
1109
1116
// randomness available to containers (test reads about 2.5MB from /dev/random w/ an overall test
1110
1117
// timeout of 60 seconds). It also validates that the quality of the randomness passes the rngtest
@@ -1201,9 +1208,11 @@ func TestRandomness_Isolated(t *testing.T) {
1201
1208
// Even though we have a failure tolerance, the test still provides some
1202
1209
// value in that we can be aware if a change to the rootfs results in a
1203
1210
// regression.
1204
- require .EqualValues (t , 1 , rngtestCmd .ProcessState .ExitCode ())
1205
- const failureTolerance = 4
1211
+ exitErr , ok := err .(* exec.ExitError )
1212
+ require .True (t , ok , "the error is not ExitError" )
1213
+ require .EqualValues (t , 1 , exitCode (exitErr ))
1206
1214
1215
+ const failureTolerance = 4
1207
1216
for _ , outputLine := range strings .Split (rngtestStderr .String (), "\n " ) {
1208
1217
var failureCount int
1209
1218
_ , err := fmt .Sscanf (strings .TrimSpace (outputLine ), "rngtest: FIPS 140-2 failures: %d" , & failureCount )
0 commit comments