skip tests that don't work in CircleCI due to unwritable cgroup.

This commit is contained in:
Raúl Kripalani 2021-01-18 22:15:47 +00:00
parent cf7bf56a2b
commit f631fb2ee4
3 changed files with 13 additions and 9 deletions

View File

@ -3,11 +3,18 @@ SHELL = /bin/bash
.PHONY: test
# these tests run in isolation by calling go test -run=... or the equivalent.
ISOLATED_TESTS = TestControl_Isolated \
TestSystemDriven_Isolated \
TestHeapDriven_Isolated \
TestCgroupsDriven_Create_Isolated \
TestCgroupsDriven_Docker_Isolated
ISOLATED_TESTS +=
ifdef CI
ISOLATED_TESTS = TestControl_Isolated \
TestSystemDriven_Isolated \
TestHeapDriven_Isolated
else
ISOLATED_TESTS = TestControl_Isolated \
TestSystemDriven_Isolated \
TestHeapDriven_Isolated \
TestCgroupsDriven_Create_Isolated \
TestCgroupsDriven_Docker_Isolated
endif
test: test-binary test-docker
@ -27,4 +34,3 @@ test-docker: docker
docker:
docker build -f ./Dockerfile.test -t raulk/watchdog:latest .

View File

@ -19,8 +19,6 @@ import (
var retained [][]byte
func TestCgroupsDriven_Create_Isolated(t *testing.T) {
t.Skip("does not work on CI because cgroups are non writable")
skipIfNotIsolated(t)
if os.Getpid() == 1 {

View File

@ -119,7 +119,7 @@ func TestHeapDriven_Isolated(t *testing.T) {
var ms runtime.MemStats
runtime.ReadMemStats(&ms)
require.GreaterOrEqual(t, ms.NumGC, uint32(9)) // over 9 GCs should've taken place.
require.GreaterOrEqual(t, ms.NumGC, uint32(5)) // over 5 GCs should've taken place.
}
func TestSystemDriven_Isolated(t *testing.T) {