Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Un-Skipping reconciler unit tests for the all providers #7758

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/awsiamauth/reconciler/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestReconcileKCPObjectNotFound(t *testing.T) {
r := reconciler.New(certs, generateUUID, cl, remoteClientRegistry)
result, err := r.Reconcile(ctx, nullLog(), cluster)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(result).To(Equal(controller.ResultWithRequeue(5 * time.Second)))
g.Expect(result).To(Equal(controller.ResultWithRequeue(4 * time.Second)))
}

func TestReconcileRemoteGetClientError(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/clusters/clusterapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func CheckControlPlaneReady(ctx context.Context, client client.Client, log logr.

if kcp == nil {
log.Info("KCP does not exist yet, requeuing")
return controller.ResultWithRequeue(5 * time.Second), nil
return controller.ResultWithRequeue(4 * time.Second), nil
}

// We make sure to check that the status is up to date before using it
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/clusters/clusterapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestCheckControlPlaneReadyNoKcp(t *testing.T) {
result, err := clusters.CheckControlPlaneReady(ctx, client, test.NewNullLogger(), eksaCluster)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(result).To(Equal(
controller.Result{Result: &controllerruntime.Result{RequeueAfter: 5 * time.Second}}),
controller.Result{Result: &controllerruntime.Result{RequeueAfter: 4 * time.Second}}),
)
}

Expand Down
10 changes: 7 additions & 3 deletions pkg/providers/docker/reconciler/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/pointer"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
Expand All @@ -38,9 +39,7 @@ const (
clusterNamespace = "test-namespace"
)

func TestReconcilerReconcileSuccess(t *testing.T) {
t.Skip("Flaky (https://github.com/aws/eks-anywhere/issues/6996)")

func TestDockerReconcilerReconcileSuccess(t *testing.T) {
tt := newReconcilerTest(t)
logger := test.NewNullLogger()

Expand Down Expand Up @@ -476,14 +475,17 @@ func newReconcilerTest(t testing.TB) *reconcilerTest {
c.Spec.EksaVersion = &version
})

kcpVersion := "v1.19.8"
kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) {
kcp.Name = cluster.Name
kcp.ObjectMeta.Generation = 2
kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{
MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{
InfrastructureRef: corev1.ObjectReference{
Name: fmt.Sprintf("%s-control-plane-1", cluster.Name),
},
},
Version: kcpVersion,
}
kcp.Status = controlplanev1.KubeadmControlPlaneStatus{
Conditions: clusterv1.Conditions{
Expand All @@ -494,6 +496,8 @@ func newReconcilerTest(t testing.TB) *reconcilerTest {
},
},
ObservedGeneration: 2,
Ready: true,
Version: pointer.String(kcpVersion),
}
})

Expand Down
13 changes: 9 additions & 4 deletions pkg/providers/snow/reconciler/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ const (
clusterNamespace = "test-namespace"
)

func TestReconcilerReconcileSuccess(t *testing.T) {
t.Skip("Flaky (https://github.com/aws/eks-anywhere/issues/6996)")

func TestSnowReconcilerReconcileSuccess(t *testing.T) {
tt := newReconcilerTest(t)
// We want to check that the cluster status is cleaned up if validations are passed
tt.cluster.SetFailure(anywherev1.FailureReasonType("InvalidCluster"), "invalid cluster")
Expand Down Expand Up @@ -241,7 +239,9 @@ func TestReconcilerCheckControlPlaneReadyItIsReady(t *testing.T) {
LastTransitionTime: metav1.NewTime(time.Now()),
},
},
Version: pointer.String(kcpVersion),
ObservedGeneration: 2,
Version: pointer.String(kcpVersion),
Ready: true,
}
tt.eksaSupportObjs = append(tt.eksaSupportObjs, tt.kcp)
tt.withFakeClient()
Expand Down Expand Up @@ -398,14 +398,17 @@ func newReconcilerTest(t testing.TB) *reconcilerTest {
c.Spec.EksaVersion = &version
})

kcpVersion := "v1.19.8"
kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) {
kcp.Name = cluster.Name
kcp.ObjectMeta.Generation = 2
kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{
MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{
InfrastructureRef: corev1.ObjectReference{
Name: fmt.Sprintf("%s-control-plane-1", cluster.Name),
},
},
Version: kcpVersion,
}
kcp.Status = controlplanev1.KubeadmControlPlaneStatus{
Conditions: clusterv1.Conditions{
Expand All @@ -416,6 +419,8 @@ func newReconcilerTest(t testing.TB) *reconcilerTest {
},
},
ObservedGeneration: 2,
Ready: true,
Version: pointer.String(kcpVersion),
}
})

Expand Down
11 changes: 7 additions & 4 deletions pkg/providers/tinkerbell/reconciler/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/pointer"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
Expand Down Expand Up @@ -55,9 +56,7 @@ func TestReconcilerGenerateSpec(t *testing.T) {
tt.cleanup()
}

func TestReconcilerReconcileSuccess(t *testing.T) {
t.Skip("Flaky (https://github.com/aws/eks-anywhere/issues/6996)")

func TestTinkerbellReconcilerReconcileSuccess(t *testing.T) {
tt := newReconcilerTest(t)

capiCluster := test.CAPICluster(func(c *clusterv1.Cluster) {
Expand Down Expand Up @@ -937,15 +936,17 @@ func newReconcilerTest(t testing.TB) *reconcilerTest {
c.Spec.EksaVersion = &version
})

kcpVersion := "v1.19.8"
kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) {
kcp.Name = cluster.Name
kcp.ObjectMeta.Generation = 2
kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{
MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{
InfrastructureRef: corev1.ObjectReference{
Name: fmt.Sprintf("%s-control-plane-1", cluster.Name),
},
},
Version: "v1.19.8",
Version: kcpVersion,
Replicas: ptr.Int32(1),
}
kcp.Status = controlplanev1.KubeadmControlPlaneStatus{
Expand All @@ -957,6 +958,8 @@ func newReconcilerTest(t testing.TB) *reconcilerTest {
},
},
ObservedGeneration: 2,
Ready: true,
Version: pointer.String(kcpVersion),
}
})

Expand Down
17 changes: 11 additions & 6 deletions pkg/providers/vsphere/reconciler/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
vspherev1 "sigs.k8s.io/cluster-api-provider-vsphere/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
Expand Down Expand Up @@ -45,9 +46,7 @@ const (
clusterNamespace = "test-namespace"
)

func TestReconcilerReconcileSuccess(t *testing.T) {
t.Skip("Flaky (https://github.com/aws/eks-anywhere/issues/6996)")

func TestVSphereReconcilerReconcileSuccess(t *testing.T) {
tt := newReconcilerTest(t)
// We want to check that the cluster status is cleaned up if validations are passed
tt.cluster.SetFailure(anywherev1.FailureReasonType("InvalidCluster"), "invalid cluster")
Expand Down Expand Up @@ -165,10 +164,9 @@ func TestSetupEnvVars(t *testing.T) {
tt.Expect(err).To(BeNil())
}

func TestReconcilerControlPlaneIsNotReady(t *testing.T) {
t.Skip("Flaky (https://github.com/aws/eks-anywhere/issues/7000)")

func TestVSphereReconcilerControlPlaneIsNotReady(t *testing.T) {
tt := newReconcilerTest(t)
kcpVersion := "v1.19.8"
tt.kcp.Status = controlplanev1.KubeadmControlPlaneStatus{
Conditions: clusterv1.Conditions{
{
Expand All @@ -178,6 +176,8 @@ func TestReconcilerControlPlaneIsNotReady(t *testing.T) {
},
},
ObservedGeneration: 2,
Ready: true,
Version: pointer.String(kcpVersion),
}

tt.eksaSupportObjs = append(tt.eksaSupportObjs, tt.kcp)
Expand Down Expand Up @@ -440,14 +440,17 @@ func newReconcilerTest(t testing.TB) *reconcilerTest {
c.Spec.EksaVersion = &version
})

kcpVersion := "v1.19.8"
kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) {
kcp.Name = cluster.Name
kcp.ObjectMeta.Generation = 2
kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{
MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{
InfrastructureRef: corev1.ObjectReference{
Name: fmt.Sprintf("%s-control-plane-1", cluster.Name),
},
},
Version: kcpVersion,
}
kcp.Status = controlplanev1.KubeadmControlPlaneStatus{
Conditions: clusterv1.Conditions{
Expand All @@ -458,6 +461,8 @@ func newReconcilerTest(t testing.TB) *reconcilerTest {
},
},
ObservedGeneration: 2,
Ready: true,
Version: pointer.String(kcpVersion),
}
})

Expand Down