Skip to content

Commit

Permalink
Remove redundant E2E test
Browse files Browse the repository at this point in the history
The E2E test is redundant after medik8s#48 PR, and it also fails here when we try to add/remove taint for a node which doesn't exist - dummy-node
  • Loading branch information
razo7 committed Jun 8, 2023
1 parent 5e3e32c commit fa23382
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
8 changes: 4 additions & 4 deletions controllers/fenceagentsremediation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (r *FenceAgentsRemediationReconciler) Reconcile(ctx context.Context, req ct
if err := r.Client.Update(context.Background(), far); err != nil {
return emptyResult, fmt.Errorf("failed to remove finalizer from CR - %w", err)
}
r.Log.Info("finalizer was removed", "CR Name", req.Name)
r.Log.Info("Finalizer was removed", "CR Name", req.Name)
return emptyResult, nil
}

Expand All @@ -116,11 +116,11 @@ func (r *FenceAgentsRemediationReconciler) Reconcile(ctx context.Context, req ct
return emptyResult, err
}
if !valid {
r.Log.Info("didn't find a node matching the CR's name", "CR's Name", req.Name)
r.Log.Info("Didn't find a node matching the CR's name", "CR's Name", req.Name)
return emptyResult, nil
}
// Fetch the FAR's pod
r.Log.Info("Fetch FAR's pod", "CR Name", req.Name)
r.Log.Info("Fetch FAR's pod", "Node Name", req.Name)
pod, err := utils.GetFenceAgentsRemediationPod(r.Client)
if err != nil {
return emptyResult, err
Expand All @@ -133,7 +133,7 @@ func (r *FenceAgentsRemediationReconciler) Reconcile(ctx context.Context, req ct
return emptyResult, err
}
// Add medik8s remediation taint
r.Log.Info("Add Medik8s remediation taint", "Fence Agent", far.Spec.Agent, "Node Name", req.Name)
r.Log.Info("Add Medik8s remediation taint", "Node Name", req.Name)
if err := utils.HandleTaint(r.Client, farV1alpha1.FARNoExecuteTaint, farV1alpha1.AppendTaintAction, far); err != nil {
return emptyResult, err
}
Expand Down
24 changes: 2 additions & 22 deletions test/e2e/far_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var _ = Describe("FAR E2e", func() {
fenceAgent string
clusterPlatform *configv1.Infrastructure
err error
testNodeName string
)
BeforeEach(func() {
clusterPlatform, err = e2eUtils.GetClusterInfo(configClient)
Expand All @@ -49,29 +50,8 @@ var _ = Describe("FAR E2e", func() {
fmt.Printf("\ncluster name: %s and PlatformType: %s \n", string(clusterPlatform.Name), string(clusterPlatform.Status.PlatformStatus.Type))
})

Context("fence agent - dummy", func() {
testNodeName := "dummy-node"
fenceAgent = fenceAgentDummyName

BeforeEach(func() {
testShareParam := map[v1alpha1.ParameterName]string{}
testNodeParam := map[v1alpha1.ParameterName]map[v1alpha1.NodeName]string{}
far = createFAR(testNodeName, fenceAgent, testShareParam, testNodeParam)
})

AfterEach(func() {
deleteFAR(far)
})

It("should check whether the CR has been created", func() {
testFarCR := &v1alpha1.FenceAgentsRemediation{}
Expect(k8sClient.Get(context.Background(), client.ObjectKeyFromObject(far), testFarCR)).To(Succeed(), "failed to get FAR CR")
})
})

Context("fence agent - non-Dummy", func() {
Context("fence agent", func() {
BeforeEach(func() {
var testNodeName string
nodes := &corev1.NodeList{}
Expect(k8sClient.List(context.Background(), nodes, &client.ListOptions{})).ToNot(HaveOccurred())
if len(nodes.Items) <= 1 {
Expand Down

0 comments on commit fa23382

Please sign in to comment.