Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9212246

Browse files
authored
Merge pull request#132827 from guptaNswati/e2e-podresourcesGet-featuregate
Add feature gate enable test for KubeletPodResourcesGet
2 parents4b263ba +14a5ef5 commit9212246

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

‎test/e2e_node/podresources_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,48 @@ var _ = SIGDescribe("POD Resources API", framework.WithSerial(), feature.PodReso
11151115
initialConfig.FeatureGates[string(kubefeatures.KubeletPodResourcesGet)]=true
11161116
})
11171117

1118+
ginkgo.Context("with KubeletPodResourcesGet feature gate enabled",func() {
1119+
ginkgo.BeforeEach(func() {
1120+
e2eskipper.SkipUnlessFeatureGateEnabled("KubeletPodResourcesGet")
1121+
})
1122+
1123+
ginkgo.It("should succeed when calling Get for a valid pod",func(ctx context.Context) {
1124+
endpoint,err:=util.LocalEndpoint(defaultPodResourcesPath,podresources.Socket)
1125+
framework.ExpectNoError(err,"LocalEndpoint() faild err: %v",err)
1126+
1127+
cli,conn,err:=podresources.GetV1Client(endpoint,defaultPodResourcesTimeout,defaultPodResourcesMaxSize)
1128+
framework.ExpectNoError(err,"GetV1Client() failed err: %v",err)
1129+
deferframework.ExpectNoError(conn.Close())
1130+
1131+
ginkgo.By("checking Get succeeds when the feature gate is enabled")
1132+
pd:=podDesc{
1133+
podName:"fg-enabled-pod",
1134+
cntName:"fg-enabled-cnt",
1135+
cpuRequest:1000,
1136+
}
1137+
pod:=makePodResourcesTestPod(pd)
1138+
pod=e2epod.NewPodClient(f).Create(ctx,pod)
1139+
defere2epod.NewPodClient(f).DeleteSync(ctx,pod.Name, metav1.DeleteOptions{},f.Timeouts.PodDelete)
1140+
err=e2epod.WaitForPodCondition(ctx,f.ClientSet,pod.Namespace,pod.Name,"Ready",2*time.Minute,testutils.PodRunningReady)
1141+
framework.ExpectNoError(err)
1142+
1143+
res,err:=cli.Get(ctx,&kubeletpodresourcesv1.GetPodResourcesRequest{
1144+
PodName:pod.Name,
1145+
PodNamespace:pod.Namespace,
1146+
})
1147+
1148+
framework.Logf("Get result: %v, err: %v",res,err)
1149+
framework.ExpectNoError(err,"Expected Get to succeed with the feature gate enabled")
1150+
gomega.Expect(res.PodResources.Name).To(gomega.Equal(pod.Name))
1151+
gomega.Expect(res.PodResources.Containers).To(gomega.HaveLen(1),"expected one container")
1152+
container:=res.PodResources.Containers[0]
1153+
gomega.Expect(container.Name).To(gomega.Equal(pd.cntName),"expected container name match")
1154+
gomega.Expect(container.CpuIds).ToNot(gomega.BeEmpty(),"expected CPU IDs to be reported")
1155+
gomega.Expect(container.CpuIds).To(gomega.HaveLen(pd.CpuRequestExclusive()),"expected one exclusive CPU")
1156+
gomega.Expect(container.Devices).To(gomega.BeEmpty(),"expected no devices")
1157+
})
1158+
})
1159+
11181160
ginkgo.It("should return the expected responses",func(ctx context.Context) {
11191161
onlineCPUs,err:=getOnlineCPUs()
11201162
framework.ExpectNoError(err,"getOnlineCPUs() failed err: %v",err)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp