removed e2e tests for cgroups2 and associated functions
This commit is contained in:
parent
475adf734a
commit
c5dad5e461
5 changed files with 21 additions and 137 deletions
|
@ -60,10 +60,6 @@ func NumCPU() int {
|
||||||
return int(math.Ceil(float64(cpuQuota) / float64(cpuPeriod)))
|
return int(math.Ceil(float64(cpuQuota) / float64(cpuPeriod)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsCgroupAvaliable() bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func getCgroupVersion() int64 {
|
func getCgroupVersion() int64 {
|
||||||
// /sys/fs/cgroup/cgroup.controllers will not exist with cgroupsv1
|
// /sys/fs/cgroup/cgroup.controllers will not exist with cgroupsv1
|
||||||
if _, err := os.Stat("/sys/fs/cgroup/cgroup.controllers"); err == nil {
|
if _, err := os.Stat("/sys/fs/cgroup/cgroup.controllers"); err == nil {
|
||||||
|
|
|
@ -26,8 +26,4 @@ import (
|
||||||
// NumCPU ...
|
// NumCPU ...
|
||||||
func NumCPU() int {
|
func NumCPU() int {
|
||||||
return runtime.NumCPU()
|
return runtime.NumCPU()
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsCgroupAvaliable() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
//go:build linux
|
|
||||||
// +build linux
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright 2020 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cgroups
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/onsi/ginkgo/v2"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
|
|
||||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
|
||||||
|
|
||||||
"k8s.io/ingress-nginx/pkg/util/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
var _ = framework.IngressNginxDescribeSerial("[CGroups] cgroups", func() {
|
|
||||||
f := framework.NewDefaultFramework("cgroups")
|
|
||||||
|
|
||||||
ginkgo.BeforeEach(func() {
|
|
||||||
f.NewEchoDeployment()
|
|
||||||
f.NewSlowEchoDeployment()
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.It("detects if cgroups is avaliable", func() {
|
|
||||||
assert.Equal(ginkgo.GinkgoT(), runtime.IsCgroupAvaliable(), 1)
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.It("detects cgroups version v1", func() {
|
|
||||||
assert.Equal(ginkgo.GinkgoT(), runtime.readCgroupFileToInt64(), 1)
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.It("detects number of CPUs properly in cgroups v1", func() {
|
|
||||||
assert.Equal(ginkgo.GinkgoT(), runtime.NumCPU(), -1)
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.It("detects cgroups version v2", func() {
|
|
||||||
// create cgroups2 files
|
|
||||||
if err := os.MkdirAll("a/b/c/d", os.ModePerm); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.It("detects number of CPUs properly in cgroups v2", func() {
|
|
||||||
assert.Equal(ginkgo.GinkgoT(), runtime.NumCPU(), -1)
|
|
||||||
})
|
|
||||||
})
|
|
|
@ -1,42 +0,0 @@
|
||||||
//go:build !linux
|
|
||||||
// +build !linux
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright 2020 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cgroups
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/onsi/ginkgo/v2"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
|
|
||||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
|
||||||
|
|
||||||
"k8s.io/ingress-nginx/pkg/util/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
var _ = framework.IngressNginxDescribeSerial("[CGroups] cgroups", func() {
|
|
||||||
f := framework.NewDefaultFramework("cgroups")
|
|
||||||
|
|
||||||
ginkgo.BeforeEach(func() {
|
|
||||||
f.NewEchoDeployment()
|
|
||||||
f.NewSlowEchoDeployment()
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.It("detects cgroups is not avaliable", func() {
|
|
||||||
assert.True(ginkgo.GinkgoT(), !runtime.IsCgroupAvaliable())
|
|
||||||
})
|
|
||||||
})
|
|
|
@ -29,27 +29,26 @@ import (
|
||||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||||
|
|
||||||
// tests to run
|
// tests to run
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/admission"
|
_ "k8s.io/ingress-nginx/test/e2e/admission"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/annotations"
|
_ "k8s.io/ingress-nginx/test/e2e/annotations"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/annotations/modsecurity"
|
_ "k8s.io/ingress-nginx/test/e2e/annotations/modsecurity"
|
||||||
_ "k8s.io/ingress-nginx/test/e2e/cgroups"
|
_ "k8s.io/ingress-nginx/test/e2e/dbg"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/dbg"
|
_ "k8s.io/ingress-nginx/test/e2e/defaultbackend"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/defaultbackend"
|
_ "k8s.io/ingress-nginx/test/e2e/endpointslices"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/endpointslices"
|
_ "k8s.io/ingress-nginx/test/e2e/gracefulshutdown"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/gracefulshutdown"
|
_ "k8s.io/ingress-nginx/test/e2e/ingress"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/ingress"
|
_ "k8s.io/ingress-nginx/test/e2e/leaks"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/leaks"
|
_ "k8s.io/ingress-nginx/test/e2e/loadbalance"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/loadbalance"
|
_ "k8s.io/ingress-nginx/test/e2e/lua"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/lua"
|
_ "k8s.io/ingress-nginx/test/e2e/nginx"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/nginx"
|
_ "k8s.io/ingress-nginx/test/e2e/security"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/security"
|
_ "k8s.io/ingress-nginx/test/e2e/servicebackend"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/servicebackend"
|
_ "k8s.io/ingress-nginx/test/e2e/settings"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/settings"
|
_ "k8s.io/ingress-nginx/test/e2e/settings/modsecurity"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/settings/modsecurity"
|
_ "k8s.io/ingress-nginx/test/e2e/settings/ocsp"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/settings/ocsp"
|
_ "k8s.io/ingress-nginx/test/e2e/ssl"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/ssl"
|
_ "k8s.io/ingress-nginx/test/e2e/status"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/status"
|
_ "k8s.io/ingress-nginx/test/e2e/tcpudp"
|
||||||
// _ "k8s.io/ingress-nginx/test/e2e/tcpudp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// RunE2ETests checks configuration parameters (specified through flags) and then runs
|
// RunE2ETests checks configuration parameters (specified through flags) and then runs
|
||||||
|
|
Loading…
Reference in a new issue