Skip to content

Commit

Permalink
fix compile
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Jan 31, 2025
1 parent 30ac410 commit b452e2e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
4 changes: 1 addition & 3 deletions operator/pkg/cli/migrate_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package cli

import (
"fmt"
"log"

ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
"github.com/replicatedhq/embedded-cluster/operator/pkg/cli/migratev2"
"github.com/replicatedhq/embedded-cluster/operator/pkg/k8sutil"
Expand Down Expand Up @@ -42,7 +40,7 @@ func MigrateV2Cmd() *cobra.Command {
return fmt.Errorf("failed to create kubernetes client: %w", err)
}

err = migratev2.Run(ctx, log.Printf, cli, installation)
err = migratev2.Run(ctx, cli, installation)
if err != nil {
return fmt.Errorf("failed to run v2 migration: %w", err)
}
Expand Down
29 changes: 16 additions & 13 deletions operator/pkg/cli/migratev2/installation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package migratev2
import (
"context"
"fmt"
"log/slog"
"testing"

ecv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
Expand All @@ -15,6 +16,10 @@ import (
)

func Test_setV2MigrationInProgress(t *testing.T) {
// Discard log messages
old := slog.SetLogLoggerLevel(slog.LevelError)
defer slog.SetLogLoggerLevel(old)

scheme := runtime.NewScheme()
require.NoError(t, ecv1beta1.AddToScheme(scheme))

Expand Down Expand Up @@ -76,10 +81,7 @@ func Test_setV2MigrationInProgress(t *testing.T) {
WithStatusSubresource(&ecv1beta1.Installation{}).
Build()

// Discard log messages
logf := func(format string, args ...any) {}

err := setV2MigrationInProgress(context.Background(), logf, cli, tt.args.installation)
err := setV2MigrationInProgress(context.Background(), cli, tt.args.installation)
require.NoError(t, err)

// Verify that the condition was set correctly
Expand All @@ -97,6 +99,10 @@ func Test_setV2MigrationInProgress(t *testing.T) {
}

func Test_setV2MigrationComplete(t *testing.T) {
// Discard log messages
old := slog.SetLogLoggerLevel(slog.LevelError)
defer slog.SetLogLoggerLevel(old)

scheme := runtime.NewScheme()
require.NoError(t, ecv1beta1.AddToScheme(scheme))

Expand Down Expand Up @@ -156,11 +162,7 @@ func Test_setV2MigrationComplete(t *testing.T) {
WithObjects(tt.args.installation).
WithStatusSubresource(&ecv1beta1.Installation{}).
Build()

// Discard log messages
logf := func(format string, args ...any) {}

err := setV2MigrationComplete(context.Background(), logf, cli, tt.args.installation)
err := setV2MigrationComplete(context.Background(), cli, tt.args.installation)
require.NoError(t, err)

// Verify that the condition was set correctly
Expand All @@ -178,6 +180,10 @@ func Test_setV2MigrationComplete(t *testing.T) {
}

func Test_setV2MigrationFailed(t *testing.T) {
// Discard log messages
old := slog.SetLogLoggerLevel(slog.LevelError)
defer slog.SetLogLoggerLevel(old)

scheme := runtime.NewScheme()
require.NoError(t, ecv1beta1.AddToScheme(scheme))

Expand Down Expand Up @@ -241,10 +247,7 @@ func Test_setV2MigrationFailed(t *testing.T) {
WithStatusSubresource(&ecv1beta1.Installation{}).
Build()

// Discard log messages
logf := func(format string, args ...any) {}

err := setV2MigrationFailed(context.Background(), logf, cli, tt.args.installation, tt.args.failure)
err := setV2MigrationFailed(context.Background(), cli, tt.args.installation, tt.args.failure)
require.NoError(t, err)

// Verify that the condition was set correctly
Expand Down

0 comments on commit b452e2e

Please sign in to comment.