Skip to content

Commit

Permalink
e2e: make restarting pods generic
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerdev committed Jul 1, 2024
1 parent 91a6a0c commit c18d4da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions e2e/internal/kubeclient/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ func (c *Kubeclient) Delete(ctx context.Context, objects ...*unstructured.Unstru
return nil
}

// RestartDeployment restarts a deployment by deleting all of its pods.
func (c *Kubeclient) RestartDeployment(ctx context.Context, namespace, name string) error {
pods, err := c.PodsFromDeployment(ctx, namespace, name)
// Restart a resource by deleting all of its dependent pods.
func (c *Kubeclient) Restart(ctx context.Context, resource ResourceWaiter, namespace, name string) error {
pods, err := resource.getPods(ctx, c, namespace, name)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/openssl/openssl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func TestOpenSSL(t *testing.T) {
ct.Set(t)

// Restart one deployment so it has the new certificates.
require.NoError(c.RestartDeployment(ctx, ct.Namespace, deploymentToRestart))
require.NoError(c.Restart(ctx, kubeclient.Deployment{}, ct.Namespace, deploymentToRestart))
require.NoError(c.WaitFor(ctx, kubeclient.Deployment{}, ct.Namespace, deploymentToRestart))

// This should not succeed because the certificates have changed.
Expand All @@ -168,7 +168,7 @@ func TestOpenSSL(t *testing.T) {
if deploymentToRestart == opensslBackend {
d = opensslFrontend
}
require.NoError(c.RestartDeployment(ctx, ct.Namespace, d))
require.NoError(c.Restart(ctx, kubeclient.Deployment{}, ct.Namespace, d))
require.NoError(c.WaitFor(ctx, kubeclient.Deployment{}, ct.Namespace, d))

// This should succeed since both workloads now have updated certificates.
Expand Down

0 comments on commit c18d4da

Please sign in to comment.