diff --git a/.golangci.yml b/.golangci.yml index 2c1c30a1e..cbd9584b4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,3 +1,6 @@ +run: + timeout: 5m + linters: disable-all: true enable: diff --git a/.travis.yml b/.travis.yml index 142063d04..5ea781b90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,5 +13,7 @@ install: - make deps script: + # "make" must be happening before "make lint" to download dependencies - make - make lint + - make test diff --git a/runtime/service_integ_test.go b/runtime/service_integ_test.go index 8fb523253..19b4ac1e5 100644 --- a/runtime/service_integ_test.go +++ b/runtime/service_integ_test.go @@ -1105,6 +1105,13 @@ func TestUpdateVMMetadata_Isolated(t *testing.T) { assert.Equalf(t, "45", stdout, "container %q did not emit expected stdout", containerName) } +func exitCode(err *exec.ExitError) int { + if status, ok := err.Sys().(syscall.WaitStatus); ok { + return int(status) + } + return -1 +} + // TestRandomness validates that there is a reasonable amount of entropy available to the VM and thus // randomness available to containers (test reads about 2.5MB from /dev/random w/ an overall test // 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) { // Even though we have a failure tolerance, the test still provides some // value in that we can be aware if a change to the rootfs results in a // regression. - require.EqualValues(t, 1, rngtestCmd.ProcessState.ExitCode()) - const failureTolerance = 4 + exitErr, ok := err.(*exec.ExitError) + require.True(t, ok, "the error is not ExitError") + require.EqualValues(t, 1, exitCode(exitErr)) + const failureTolerance = 4 for _, outputLine := range strings.Split(rngtestStderr.String(), "\n") { var failureCount int _, err := fmt.Sscanf(strings.TrimSpace(outputLine), "rngtest: FIPS 140-2 failures: %d", &failureCount)