mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
operator: cleanup resources between tests (#1049)
This commit is contained in:
parent
bb6f35fbf4
commit
effe797d81
@ -86,7 +86,7 @@ func NewNodeVersionReconciler(nodeReplacer nodeReplacer, etcdRemover etcdRemover
|
||||
//+kubebuilder:rbac:groups="",resources=nodes/status,verbs=get
|
||||
//+kubebuilder:rbac:groups="",resources=configmaps,verbs=list;get
|
||||
|
||||
// Reconcile replaces outdated nodes (using an old image) with new nodes (using a new image) as specified in the NodeVersion spec.
|
||||
// Reconcile replaces outdated nodes with new nodes as specified in the NodeVersion spec.
|
||||
func (r *NodeVersionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
|
||||
logr := log.FromContext(ctx)
|
||||
logr.Info("Reconciling NodeVersion")
|
||||
|
@ -26,6 +26,39 @@ import (
|
||||
)
|
||||
|
||||
var _ = Describe("NodeVersion controller", func() {
|
||||
AfterEach(func() {
|
||||
// cleanup all nodes
|
||||
nodeList := &corev1.NodeList{}
|
||||
Expect(k8sClient.List(context.Background(), nodeList)).To(Succeed())
|
||||
for _, node := range nodeList.Items {
|
||||
Expect(k8sClient.Delete(context.Background(), &node)).To(Succeed())
|
||||
}
|
||||
// cleanup all node versions
|
||||
nodeVersionList := &updatev1alpha1.NodeVersionList{}
|
||||
Expect(k8sClient.List(context.Background(), nodeVersionList)).To(Succeed())
|
||||
for _, nodeVersion := range nodeVersionList.Items {
|
||||
Expect(k8sClient.Delete(context.Background(), &nodeVersion)).To(Succeed())
|
||||
}
|
||||
// cleanup all scaling groups
|
||||
scalingGroupList := &updatev1alpha1.ScalingGroupList{}
|
||||
Expect(k8sClient.List(context.Background(), scalingGroupList)).To(Succeed())
|
||||
for _, scalingGroup := range scalingGroupList.Items {
|
||||
Expect(k8sClient.Delete(context.Background(), &scalingGroup)).To(Succeed())
|
||||
}
|
||||
// cleanup all pending nodes
|
||||
pendingNodeList := &updatev1alpha1.PendingNodeList{}
|
||||
Expect(k8sClient.List(context.Background(), pendingNodeList)).To(Succeed())
|
||||
for _, pendingNode := range pendingNodeList.Items {
|
||||
Expect(k8sClient.Delete(context.Background(), &pendingNode)).To(Succeed())
|
||||
}
|
||||
// cleanup all joining nodes
|
||||
joiningNodeList := &updatev1alpha1.JoiningNodeList{}
|
||||
Expect(k8sClient.List(context.Background(), joiningNodeList)).To(Succeed())
|
||||
for _, joiningNode := range joiningNodeList.Items {
|
||||
Expect(k8sClient.Delete(context.Background(), &joiningNode)).To(Succeed())
|
||||
}
|
||||
})
|
||||
|
||||
// Define utility constants for object names and testing timeouts/durations and intervals.
|
||||
const (
|
||||
nodeVersionResourceName = "nodeversion"
|
||||
|
Loading…
Reference in New Issue
Block a user