Skip to content

Commit

Permalink
Remove TestSelfSignedCertificateWithExistingEmptySecret (#87)
Browse files Browse the repository at this point in the history
Removes TestSelfSignedCertificateWithExistingEmptySecret since it's somewhat flaky.
  • Loading branch information
jhalterman authored Sep 21, 2023
1 parent cabaac5 commit e038f92
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions integration/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,46 +212,3 @@ func TestNoDownscale_UpdatingScaleSubresource(t *testing.T) {
requireEventuallyPodCount(ctx, t, api, "name=mock", 3)
}
}

func TestSelfSignedCertificateWithExistingEmptySecret(t *testing.T) {
ctx := context.Background()
cluster := k3t.NewCluster(ctx, t, k3t.WithImages("rollout-operator:latest", "mock-service:latest"))
api := cluster.API()

// Setup.
{
t.Log("Create the webhook before the rollout-operator, as rollout-operator should update its certificate.")
_, err := api.AdmissionregistrationV1().ValidatingWebhookConfigurations().Create(ctx, noDownscaleValidatingWebhook(corev1.NamespaceDefault), metav1.CreateOptions{})
require.NoError(t, err)

t.Log("Create an empty secret before the rollout-operator.")
_, err = api.CoreV1().Secrets(corev1.NamespaceDefault).Create(ctx, &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{Name: certificateSecretName},
Immutable: nil,
Data: nil,
StringData: nil,
Type: "Opaque",
}, metav1.CreateOptions{})
require.NoError(t, err)

t.Log("Create rollout-operator and check it's running and ready.")
createRolloutOperator(t, ctx, api, corev1.NamespaceDefault, true)
rolloutOperatorPod := eventuallyGetFirstPod(ctx, t, api, "name=rollout-operator")
requireEventuallyPod(t, api, ctx, rolloutOperatorPod, expectPodPhase(corev1.PodRunning), expectReady())
}

// Happy case check that webhook is working.
{
mock := mockServiceStatefulSet("mock", "1", true)
mock.ObjectMeta.Labels["grafana.com/no-downscale"] = "true"

t.Log("Create the service with one replica.")
requireCreateStatefulSet(ctx, t, api, mock)
requireEventuallyPodCount(ctx, t, api, "name=mock", 1)

t.Log("Upscaling should still work correctly as the certificate should be correct.")
mock.Spec.Replicas = ptr[int32](2)
requireUpdateStatefulSet(ctx, t, api, mock)
requireEventuallyPodCount(ctx, t, api, "name=mock", 2)
}
}

0 comments on commit e038f92

Please sign in to comment.