Skip to content

Commit da09e19

Browse files
committed
add integration test
1 parent c726652 commit da09e19

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Copyright The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package failurerecovery
18+
19+
import (
20+
"github.com/onsi/ginkgo/v2"
21+
)
22+
23+
var _ = ginkgo.Describe("Pod termination controller", ginkgo.Ordered, ginkgo.ContinueOnFailure, func() {
24+
ginkgo.It("foo", func() {
25+
})
26+
})
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
Copyright The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package failurerecovery
18+
19+
import (
20+
"context"
21+
22+
"github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/gomega"
24+
"k8s.io/client-go/rest"
25+
"sigs.k8s.io/controller-runtime/pkg/client"
26+
"sigs.k8s.io/controller-runtime/pkg/manager"
27+
config "sigs.k8s.io/kueue/apis/config/v1beta2"
28+
qcache "sigs.k8s.io/kueue/pkg/cache/queue"
29+
schdcache "sigs.k8s.io/kueue/pkg/cache/scheduler"
30+
"sigs.k8s.io/kueue/pkg/controller/core"
31+
"sigs.k8s.io/kueue/pkg/controller/core/indexer"
32+
"sigs.k8s.io/kueue/pkg/controller/failurerecovery"
33+
"sigs.k8s.io/kueue/pkg/webhooks"
34+
"sigs.k8s.io/kueue/test/integration/framework"
35+
"sigs.k8s.io/kueue/test/util"
36+
)
37+
38+
var (
39+
cfg *rest.Config
40+
k8sClient client.Client
41+
ctx context.Context
42+
fwk *framework.Framework
43+
)
44+
45+
var _ = ginkgo.BeforeSuite(func() {
46+
fwk = &framework.Framework{
47+
WebhookPath: util.WebhookPath,
48+
}
49+
cfg = fwk.Init()
50+
ctx, k8sClient = fwk.SetupClient(cfg)
51+
fwk.StartManager(ctx, cfg, managerAndSchedulerSetup)
52+
})
53+
54+
var _ = ginkgo.AfterSuite(func() {
55+
fwk.Teardown()
56+
})
57+
58+
func managerAndSchedulerSetup(ctx context.Context, mgr manager.Manager) {
59+
err := indexer.Setup(ctx, mgr.GetFieldIndexer())
60+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
61+
62+
cCache := schdcache.New(mgr.GetClient())
63+
queues := qcache.NewManager(mgr.GetClient(), cCache)
64+
65+
configuration := &config.Configuration{}
66+
mgr.GetScheme().Default(configuration)
67+
68+
failedCtrl, err := core.SetupControllers(mgr, queues, cCache, configuration)
69+
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "controller", failedCtrl)
70+
71+
failedWebhook, err := webhooks.Setup(mgr)
72+
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "webhook", failedWebhook)
73+
74+
terminatingPodReconciler := failurerecovery.NewTerminatingPodReconciler(mgr.GetClient())
75+
err = terminatingPodReconciler.SetupWithManager(mgr)
76+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
77+
78+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
79+
}

0 commit comments

Comments
 (0)