diff --git a/pkg/blueprint/blueprint_handler.go b/pkg/blueprint/blueprint_handler.go index e171d48d4..c6377e648 100644 --- a/pkg/blueprint/blueprint_handler.go +++ b/pkg/blueprint/blueprint_handler.go @@ -56,8 +56,8 @@ var defaultJsonnetTemplate string //go:embed templates/local.jsonnet var localJsonnetTemplate string -//go:embed templates/metal.jsonnet -var metalJsonnetTemplate string +//go:embed templates/talos.jsonnet +var talosJsonnetTemplate string //go:embed templates/aws.jsonnet var awsJsonnetTemplate string @@ -863,8 +863,8 @@ func (b *BaseBlueprintHandler) loadPlatformTemplate(platform string) ([]byte, er switch platform { case "local": return []byte(localJsonnetTemplate), nil - case "metal": - return []byte(metalJsonnetTemplate), nil + case "talos": + return []byte(talosJsonnetTemplate), nil case "aws": return []byte(awsJsonnetTemplate), nil case "azure": diff --git a/pkg/blueprint/blueprint_handler_helper_test.go b/pkg/blueprint/blueprint_handler_helper_test.go index eed682beb..f601ef337 100644 --- a/pkg/blueprint/blueprint_handler_helper_test.go +++ b/pkg/blueprint/blueprint_handler_helper_test.go @@ -214,7 +214,7 @@ func TestBaseBlueprintHandler_loadPlatformTemplate(t *testing.T) { handler := &BaseBlueprintHandler{} // When loading templates for valid platforms - platforms := []string{"local", "metal", "aws", "azure", "default"} + platforms := []string{"local", "talos", "aws", "azure", "default"} for _, platform := range platforms { // Then the template should be loaded successfully template, err := handler.loadPlatformTemplate(platform) diff --git a/pkg/blueprint/templates/metal.jsonnet b/pkg/blueprint/templates/talos.jsonnet similarity index 97% rename from pkg/blueprint/templates/metal.jsonnet rename to pkg/blueprint/templates/talos.jsonnet index 421a0a63b..debfaf1d8 100644 --- a/pkg/blueprint/templates/metal.jsonnet +++ b/pkg/blueprint/templates/talos.jsonnet @@ -65,11 +65,11 @@ local repositoryConfig = { }; // Terraform configuration -local terraformConfig = [ - { - path: "cluster/talos", - source: "core", - values: { +local talosInfra = if context.provider != "omni" then [{ + path: "cluster/talos", + source: "core", + parallelism: 1, + values: { cluster_endpoint: if endpoint != "" then "https://" + baseUrl + ":6443" else "", cluster_name: "talos", controlplanes: if std.objectHas(context.cluster, "controlplanes") && std.objectHas(context.cluster.controlplanes, "nodes") then @@ -172,13 +172,13 @@ local terraformConfig = [ else "", }, - }, - { - path: "gitops/flux", - source: "core", - destroy: false, - } -]; + }] else []; + +local terraformConfig = talosInfra + [{ + path: "gitops/flux", + source: "core", + destroy: false, +}]; // Kustomize configuration local kustomizeConfig = [ diff --git a/pkg/env/omni_env.go b/pkg/env/omni_env.go deleted file mode 100644 index c864aaa54..000000000 --- a/pkg/env/omni_env.go +++ /dev/null @@ -1,70 +0,0 @@ -// The OmniEnvPrinter is a specialized component that manages Omni environment configuration. -// It provides Omni-specific environment variable management and configuration, -// The OmniEnvPrinter handles Omni configuration settings and environment setup, -// ensuring proper Omni CLI integration and environment setup for operations. - -package env - -import ( - "fmt" - "path/filepath" - - "github.com/windsorcli/cli/pkg/di" -) - -// ============================================================================= -// Types -// ============================================================================= - -// OmniEnvPrinter is a struct that implements Omni environment configuration -type OmniEnvPrinter struct { - BaseEnvPrinter -} - -// ============================================================================= -// Constructor -// ============================================================================= - -// NewOmniEnvPrinter creates a new OmniEnvPrinter instance -func NewOmniEnvPrinter(injector di.Injector) *OmniEnvPrinter { - return &OmniEnvPrinter{ - BaseEnvPrinter: *NewBaseEnvPrinter(injector), - } -} - -// ============================================================================= -// Public Methods -// ============================================================================= - -// GetEnvVars retrieves the environment variables for the Omni environment. -func (e *OmniEnvPrinter) GetEnvVars() (map[string]string, error) { - envVars := make(map[string]string) - - // Determine the root directory for configuration files. - configRoot, err := e.configHandler.GetConfigRoot() - if err != nil { - return nil, fmt.Errorf("error retrieving configuration root directory: %w", err) - } - - // Construct the path to the omni config file and verify its existence. - omniConfigPath := filepath.Join(configRoot, ".omni", "config") - - // Populate environment variables with Omni configuration data. - envVars["OMNICONFIG"] = omniConfigPath - - return envVars, nil -} - -// Print prints the environment variables for the Omni environment. -func (e *OmniEnvPrinter) Print() error { - envVars, err := e.GetEnvVars() - if err != nil { - // Return the error if GetEnvVars fails - return fmt.Errorf("error getting environment variables: %w", err) - } - // Call the Print method of the embedded BaseEnvPrinter struct with the retrieved environment variables - return e.BaseEnvPrinter.Print(envVars) -} - -// Ensure OmniEnvPrinter implements the EnvPrinter interface -var _ EnvPrinter = (*OmniEnvPrinter)(nil) diff --git a/pkg/env/omni_env_test.go b/pkg/env/omni_env_test.go deleted file mode 100644 index 27af9aad7..000000000 --- a/pkg/env/omni_env_test.go +++ /dev/null @@ -1,179 +0,0 @@ -package env - -import ( - "errors" - "os" - "path/filepath" - "reflect" - "strings" - "testing" -) - -// ============================================================================= -// Test Public Methods -// ============================================================================= - -// TestOmniEnvPrinter_GetEnvVars tests the GetEnvVars method of the OmniEnvPrinter -func TestOmniEnvPrinter_GetEnvVars(t *testing.T) { - setup := func(t *testing.T) (*OmniEnvPrinter, *Mocks) { - t.Helper() - mocks := setupMocks(t) - printer := NewOmniEnvPrinter(mocks.Injector) - if err := printer.Initialize(); err != nil { - t.Fatalf("Failed to initialize env: %v", err) - } - printer.shims = mocks.Shims - return printer, mocks - } - - t.Run("Success", func(t *testing.T) { - // Given a new OmniEnvPrinter with existing Omni config - printer, mocks := setup(t) - - // Get the actual project root path - projectRoot, err := mocks.Shell.GetProjectRoot() - if err != nil { - t.Fatalf("Failed to get project root: %v", err) - } - expectedPath := filepath.Join(projectRoot, "contexts", "mock-context", ".omni", "config") - - mocks.Shims.Stat = func(name string) (os.FileInfo, error) { - if name == expectedPath { - return nil, nil - } - return nil, os.ErrNotExist - } - - // When getting environment variables - envVars, err := printer.GetEnvVars() - - // Then no error should be returned - if err != nil { - t.Fatalf("GetEnvVars returned an error: %v", err) - } - - // And OMNICONFIG should be set correctly - if envVars["OMNICONFIG"] != expectedPath { - t.Errorf("OMNICONFIG = %v, want %v", envVars["OMNICONFIG"], expectedPath) - } - }) - - t.Run("NoOmniConfig", func(t *testing.T) { - // Given a new OmniEnvPrinter without existing Omni config - printer, mocks := setup(t) - - // Get the actual project root path - projectRoot, err := mocks.Shell.GetProjectRoot() - if err != nil { - t.Fatalf("Failed to get project root: %v", err) - } - expectedPath := filepath.Join(projectRoot, "contexts", "mock-context", ".omni", "config") - mocks.Shims.Stat = func(name string) (os.FileInfo, error) { - return nil, os.ErrNotExist - } - - // When getting environment variables - envVars, err := printer.GetEnvVars() - - // Then no error should be returned - if err != nil { - t.Fatalf("GetEnvVars returned an error: %v", err) - } - - // And OMNICONFIG should still be set to default path - if envVars["OMNICONFIG"] != expectedPath { - t.Errorf("OMNICONFIG = %v, want %v", envVars["OMNICONFIG"], expectedPath) - } - }) - - t.Run("GetProjectRootError", func(t *testing.T) { - // Given a new OmniEnvPrinter with failing project root lookup - printer, mocks := setup(t) - mocks.Shell.GetProjectRootFunc = func() (string, error) { - return "", errors.New("mock context error") - } - - // When getting environment variables - _, err := printer.GetEnvVars() - - // Then appropriate error should be returned - expectedError := "error retrieving configuration root directory: mock context error" - if err == nil || err.Error() != expectedError { - t.Errorf("error = %v, want %v", err, expectedError) - } - }) -} - -// TestOmniEnvPrinter_Print tests the Print method of the OmniEnvPrinter -func TestOmniEnvPrinter_Print(t *testing.T) { - setup := func(t *testing.T) (*OmniEnvPrinter, *Mocks) { - t.Helper() - mocks := setupMocks(t) - printer := NewOmniEnvPrinter(mocks.Injector) - if err := printer.Initialize(); err != nil { - t.Fatalf("Failed to initialize env: %v", err) - } - printer.shims = mocks.Shims - return printer, mocks - } - - t.Run("Success", func(t *testing.T) { - // Given a new OmniEnvPrinter with existing Omni config - printer, mocks := setup(t) - - // Get the actual project root path - projectRoot, err := mocks.Shell.GetProjectRoot() - if err != nil { - t.Fatalf("Failed to get project root: %v", err) - } - expectedPath := filepath.Join(projectRoot, "contexts", "mock-context", ".omni", "config") - - // And Omni config file exists - mocks.Shims.Stat = func(name string) (os.FileInfo, error) { - if name == expectedPath { - return nil, nil - } - return nil, os.ErrNotExist - } - - // And PrintEnvVarsFunc is mocked - var capturedEnvVars map[string]string - mocks.Shell.PrintEnvVarsFunc = func(envVars map[string]string, export bool) { - capturedEnvVars = envVars - } - - // When calling Print - err = printer.Print() - - // Then no error should be returned - if err != nil { - t.Errorf("unexpected error: %v", err) - } - - // And environment variables should be set correctly - expectedEnvVars := map[string]string{ - "OMNICONFIG": expectedPath, - } - if !reflect.DeepEqual(capturedEnvVars, expectedEnvVars) { - t.Errorf("capturedEnvVars = %v, want %v", capturedEnvVars, expectedEnvVars) - } - }) - - t.Run("GetProjectRootError", func(t *testing.T) { - // Given a new OmniEnvPrinter with failing project root lookup - printer, mocks := setup(t) - mocks.Shell.GetProjectRootFunc = func() (string, error) { - return "", errors.New("mock config error") - } - - // When calling Print - err := printer.Print() - - // Then appropriate error should be returned - if err == nil { - t.Error("expected error, got nil") - } else if !strings.Contains(err.Error(), "mock config error") { - t.Errorf("unexpected error message: %v", err) - } - }) -} diff --git a/pkg/env/talos_env.go b/pkg/env/talos_env.go index 2a7177453..aee0a4fbb 100644 --- a/pkg/env/talos_env.go +++ b/pkg/env/talos_env.go @@ -1,8 +1,3 @@ -// The TalosEnvPrinter is a specialized component that manages Talos environment configuration. -// It provides Talos-specific environment variable management and configuration, -// The TalosEnvPrinter handles Talos configuration settings and environment setup, -// ensuring proper Talos CLI integration and environment setup for operations. - package env import ( @@ -16,7 +11,8 @@ import ( // Types // ============================================================================= -// TalosEnvPrinter is a struct that implements Talos environment configuration +// TalosEnvPrinter manages Talos environment configuration, providing Talos-specific +// environment variable management and configuration for CLI integration and environment setup. type TalosEnvPrinter struct { BaseEnvPrinter } @@ -25,7 +21,7 @@ type TalosEnvPrinter struct { // Constructor // ============================================================================= -// NewTalosEnvPrinter creates a new TalosEnvPrinter instance +// NewTalosEnvPrinter creates and returns a new TalosEnvPrinter instance using the provided injector. func NewTalosEnvPrinter(injector di.Injector) *TalosEnvPrinter { return &TalosEnvPrinter{ BaseEnvPrinter: *NewBaseEnvPrinter(injector), @@ -36,35 +32,34 @@ func NewTalosEnvPrinter(injector di.Injector) *TalosEnvPrinter { // Public Methods // ============================================================================= -// GetEnvVars retrieves the environment variables for the Talos environment. +// GetEnvVars returns a map of environment variables for the Talos environment. +// It sets the TALOSCONFIG variable and, if the cluster driver is "omni", also sets OMNICONFIG. +// Returns an error if the configuration root cannot be determined. func (e *TalosEnvPrinter) GetEnvVars() (map[string]string, error) { envVars := make(map[string]string) - - // Determine the root directory for configuration files. configRoot, err := e.configHandler.GetConfigRoot() if err != nil { return nil, fmt.Errorf("error retrieving configuration root directory: %w", err) } - - // Construct the path to the talos config file and verify its existence. talosConfigPath := filepath.Join(configRoot, ".talos", "config") - - // Populate environment variables with Talos configuration data. envVars["TALOSCONFIG"] = talosConfigPath - + provider := e.configHandler.GetString("provider", "") + if provider == "omni" { + omniConfigPath := filepath.Join(configRoot, ".omni", "config") + envVars["OMNICONFIG"] = omniConfigPath + } return envVars, nil } -// Print prints the environment variables for the Talos environment. +// Print outputs the environment variables for the Talos environment using the embedded BaseEnvPrinter. +// Returns an error if environment variable retrieval fails or printing fails. func (e *TalosEnvPrinter) Print() error { envVars, err := e.GetEnvVars() if err != nil { - // Return the error if GetEnvVars fails return fmt.Errorf("error getting environment variables: %w", err) } - // Call the Print method of the embedded BaseEnvPrinter struct with the retrieved environment variables return e.BaseEnvPrinter.Print(envVars) } -// Ensure TalosEnvPrinter implements the EnvPrinter interface +// TalosEnvPrinter implements the EnvPrinter interface. var _ EnvPrinter = (*TalosEnvPrinter)(nil) diff --git a/pkg/env/talos_env_test.go b/pkg/env/talos_env_test.go index 33335afb9..0f8f5ee71 100644 --- a/pkg/env/talos_env_test.go +++ b/pkg/env/talos_env_test.go @@ -7,6 +7,8 @@ import ( "reflect" "strings" "testing" + + "github.com/windsorcli/cli/pkg/config" ) // ============================================================================= @@ -15,9 +17,31 @@ import ( // TestTalosEnv_GetEnvVars tests the GetEnvVars method of the TalosEnvPrinter func TestTalosEnv_GetEnvVars(t *testing.T) { - setup := func(t *testing.T) (*TalosEnvPrinter, *Mocks) { + setup := func(t *testing.T, provider string) (*TalosEnvPrinter, *Mocks) { t.Helper() - mocks := setupMocks(t) + + // Create a mock config handler + mockConfigHandler := config.NewMockConfigHandler() + mockConfigHandler.GetStringFunc = func(key string, defaultValue ...string) string { + if key == "provider" { + return provider + } + return "" + } + + mocks := setupMocks(t, &SetupOptions{ + ConfigHandler: mockConfigHandler, + }) + + // Set up GetConfigRoot to return the correct path + mockConfigHandler.GetConfigRootFunc = func() (string, error) { + projectRoot, err := mocks.Shell.GetProjectRoot() + if err != nil { + return "", err + } + return filepath.Join(projectRoot, "contexts", "mock-context"), nil + } + printer := NewTalosEnvPrinter(mocks.Injector) if err := printer.Initialize(); err != nil { t.Fatalf("Failed to initialize env: %v", err) @@ -27,19 +51,19 @@ func TestTalosEnv_GetEnvVars(t *testing.T) { return printer, mocks } - t.Run("Success", func(t *testing.T) { - // Given a new TalosEnvPrinter with existing Talos config - printer, mocks := setup(t) + t.Run("TalosProvider", func(t *testing.T) { + // Given a new TalosOmniEnvPrinter with talos provider + printer, mocks := setup(t, "talos") // Get the project root path projectRoot, err := mocks.Shell.GetProjectRoot() if err != nil { t.Fatalf("Failed to get project root: %v", err) } - expectedPath := filepath.Join(projectRoot, "contexts", "mock-context", ".talos", "config") + expectedTalosPath := filepath.Join(projectRoot, "contexts", "mock-context", ".talos", "config") mocks.Shims.Stat = func(name string) (os.FileInfo, error) { - if name == expectedPath { + if name == expectedTalosPath { return nil, nil } return nil, os.ErrNotExist @@ -54,14 +78,57 @@ func TestTalosEnv_GetEnvVars(t *testing.T) { } // And TALOSCONFIG should be set correctly - if envVars["TALOSCONFIG"] != expectedPath { - t.Errorf("TALOSCONFIG = %v, want %v", envVars["TALOSCONFIG"], expectedPath) + if envVars["TALOSCONFIG"] != expectedTalosPath { + t.Errorf("TALOSCONFIG = %v, want %v", envVars["TALOSCONFIG"], expectedTalosPath) + } + + // And OMNICONFIG should not be set for talos provider + if _, exists := envVars["OMNICONFIG"]; exists { + t.Error("OMNICONFIG should not be set for talos provider") + } + }) + + t.Run("OmniProvider", func(t *testing.T) { + // Given a new TalosOmniEnvPrinter with omni provider + printer, mocks := setup(t, "omni") + + // Get the project root path + projectRoot, err := mocks.Shell.GetProjectRoot() + if err != nil { + t.Fatalf("Failed to get project root: %v", err) + } + expectedTalosPath := filepath.Join(projectRoot, "contexts", "mock-context", ".talos", "config") + expectedOmniPath := filepath.Join(projectRoot, "contexts", "mock-context", ".omni", "config") + + mocks.Shims.Stat = func(name string) (os.FileInfo, error) { + if name == expectedTalosPath || name == expectedOmniPath { + return nil, nil + } + return nil, os.ErrNotExist + } + + // When getting environment variables + envVars, err := printer.GetEnvVars() + + // Then no error should be returned + if err != nil { + t.Fatalf("GetEnvVars returned an error: %v", err) + } + + // And TALOSCONFIG should be set correctly + if envVars["TALOSCONFIG"] != expectedTalosPath { + t.Errorf("TALOSCONFIG = %v, want %v", envVars["TALOSCONFIG"], expectedTalosPath) + } + + // And OMNICONFIG should be set correctly for omni provider + if envVars["OMNICONFIG"] != expectedOmniPath { + t.Errorf("OMNICONFIG = %v, want %v", envVars["OMNICONFIG"], expectedOmniPath) } }) - t.Run("NoTalosConfig", func(t *testing.T) { - // Given a new TalosEnvPrinter without existing Talos config - printer, mocks := setup(t) + t.Run("NoConfigFiles", func(t *testing.T) { + // Given a new TalosOmniEnvPrinter without existing config files + printer, mocks := setup(t, "talos") // Get the project root path projectRoot, err := mocks.Shell.GetProjectRoot() @@ -89,9 +156,11 @@ func TestTalosEnv_GetEnvVars(t *testing.T) { }) t.Run("GetProjectRootError", func(t *testing.T) { - // Given a new TalosEnvPrinter with failing project root lookup - printer, mocks := setup(t) - mocks.Shell.GetProjectRootFunc = func() (string, error) { + // Given a new TalosOmniEnvPrinter with failing config root lookup + printer, _ := setup(t, "talos") + + // Override the GetConfigRoot to return an error + printer.configHandler.(*config.MockConfigHandler).GetConfigRootFunc = func() (string, error) { return "", errors.New("mock project root error") } @@ -108,9 +177,31 @@ func TestTalosEnv_GetEnvVars(t *testing.T) { // TestTalosEnv_Print tests the Print method of the TalosEnvPrinter func TestTalosEnv_Print(t *testing.T) { - setup := func(t *testing.T) (*TalosEnvPrinter, *Mocks) { + setup := func(t *testing.T, provider string) (*TalosEnvPrinter, *Mocks) { t.Helper() - mocks := setupMocks(t) + + // Create a mock config handler + mockConfigHandler := config.NewMockConfigHandler() + mockConfigHandler.GetStringFunc = func(key string, defaultValue ...string) string { + if key == "provider" { + return provider + } + return "" + } + + mocks := setupMocks(t, &SetupOptions{ + ConfigHandler: mockConfigHandler, + }) + + // Set up GetConfigRoot to return the correct path + mockConfigHandler.GetConfigRootFunc = func() (string, error) { + projectRoot, err := mocks.Shell.GetProjectRoot() + if err != nil { + return "", err + } + return filepath.Join(projectRoot, "contexts", "mock-context"), nil + } + printer := NewTalosEnvPrinter(mocks.Injector) if err := printer.Initialize(); err != nil { t.Fatalf("Failed to initialize env: %v", err) @@ -120,9 +211,9 @@ func TestTalosEnv_Print(t *testing.T) { return printer, mocks } - t.Run("Success", func(t *testing.T) { - // Given a new TalosEnvPrinter with existing Talos config - printer, mocks := setup(t) + t.Run("TalosProviderSuccess", func(t *testing.T) { + // Given a new TalosOmniEnvPrinter with talos provider and existing Talos config + printer, mocks := setup(t, "talos") // Get the project root path projectRoot, err := mocks.Shell.GetProjectRoot() @@ -162,9 +253,53 @@ func TestTalosEnv_Print(t *testing.T) { } }) + t.Run("OmniProviderSuccess", func(t *testing.T) { + // Given a new TalosOmniEnvPrinter with omni provider and existing config files + printer, mocks := setup(t, "omni") + + // Get the project root path + projectRoot, err := mocks.Shell.GetProjectRoot() + if err != nil { + t.Fatalf("Failed to get project root: %v", err) + } + expectedTalosPath := filepath.Join(projectRoot, "contexts", "mock-context", ".talos", "config") + expectedOmniPath := filepath.Join(projectRoot, "contexts", "mock-context", ".omni", "config") + + // And config files exist + mocks.Shims.Stat = func(name string) (os.FileInfo, error) { + if name == expectedTalosPath || name == expectedOmniPath { + return nil, nil + } + return nil, os.ErrNotExist + } + + // And PrintEnvVarsFunc is mocked + var capturedEnvVars map[string]string + mocks.Shell.PrintEnvVarsFunc = func(envVars map[string]string, export bool) { + capturedEnvVars = envVars + } + + // When calling Print + err = printer.Print() + + // Then no error should be returned + if err != nil { + t.Errorf("unexpected error: %v", err) + } + + // And environment variables should be set correctly + expectedEnvVars := map[string]string{ + "TALOSCONFIG": expectedTalosPath, + "OMNICONFIG": expectedOmniPath, + } + if !reflect.DeepEqual(capturedEnvVars, expectedEnvVars) { + t.Errorf("capturedEnvVars = %v, want %v", capturedEnvVars, expectedEnvVars) + } + }) + t.Run("GetProjectRootError", func(t *testing.T) { - // Given a new TalosEnvPrinter with failing project root lookup - printer, mocks := setup(t) + // Given a new TalosOmniEnvPrinter with failing project root lookup + printer, mocks := setup(t, "talos") mocks.Shell.GetProjectRootFunc = func() (string, error) { return "", errors.New("mock project root error") } diff --git a/pkg/pipelines/pipeline.go b/pkg/pipelines/pipeline.go index edb07b1eb..dd84a03a0 100644 --- a/pkg/pipelines/pipeline.go +++ b/pkg/pipelines/pipeline.go @@ -547,17 +547,7 @@ func (p *BasePipeline) withEnvPrinters() ([]envpkg.EnvPrinter, error) { } clusterDriver := p.configHandler.GetString("cluster.driver", "") - if clusterDriver == "talos" { - talosEnv := envpkg.NewTalosEnvPrinter(p.injector) - envPrinters = append(envPrinters, talosEnv) - p.injector.Register("talosEnv", talosEnv) - } - - if clusterDriver == "omni" { - omniEnv := envpkg.NewOmniEnvPrinter(p.injector) - envPrinters = append(envPrinters, omniEnv) - p.injector.Register("omniEnv", omniEnv) - + if clusterDriver == "talos" || clusterDriver == "omni" { talosEnv := envpkg.NewTalosEnvPrinter(p.injector) envPrinters = append(envPrinters, talosEnv) p.injector.Register("talosEnv", talosEnv) diff --git a/pkg/pipelines/pipeline_test.go b/pkg/pipelines/pipeline_test.go index 31d293541..184a65d77 100644 --- a/pkg/pipelines/pipeline_test.go +++ b/pkg/pipelines/pipeline_test.go @@ -1300,7 +1300,7 @@ func TestBasePipeline_withEnvPrinters(t *testing.T) { } }) - t.Run("CreatesOmniAndTalosEnvPrintersWhenOmniProvider", func(t *testing.T) { + t.Run("CreatesTalosEnvPrinterWhenOmniProvider", func(t *testing.T) { // Given a base pipeline with omni cluster provider pipeline := NewBasePipeline() @@ -1322,13 +1322,13 @@ func TestBasePipeline_withEnvPrinters(t *testing.T) { // When creating env printers envPrinters, err := pipeline.withEnvPrinters() - // Then no error should be returned and Omni, Talos, and Windsor env printers should be created + // Then no error should be returned and Talos and Windsor env printers should be created if err != nil { t.Errorf("Expected no error, got %v", err) } - // Should have Omni, Talos, and Windsor - if len(envPrinters) != 3 { - t.Errorf("Expected 3 env printers, got %d", len(envPrinters)) + // Should have Talos and Windsor + if len(envPrinters) != 2 { + t.Errorf("Expected 2 env printers, got %d", len(envPrinters)) } }) @@ -1423,7 +1423,7 @@ func TestBasePipeline_withEnvPrinters(t *testing.T) { } }) - t.Run("RegistersOmniAndTalosEnvPrintersInDIContainer", func(t *testing.T) { + t.Run("RegistersTalosEnvPrinterInDIContainer", func(t *testing.T) { // Given a base pipeline with omni cluster provider pipeline := NewBasePipeline() @@ -1456,9 +1456,8 @@ func TestBasePipeline_withEnvPrinters(t *testing.T) { t.Errorf("Expected no error, got %v", err) } - // And omni, talos, terraform, and windsor env printers should be registered + // And talos, terraform, and windsor env printers should be registered expectedRegistrations := []string{ - "omniEnv", "talosEnv", "terraformEnv", // Always registered "windsorEnv", @@ -1472,9 +1471,9 @@ func TestBasePipeline_withEnvPrinters(t *testing.T) { } // And the correct number of env printers should be returned - // Should have Omni, Talos, and Windsor (terraform not included in slice when disabled) - if len(envPrinters) != 3 { - t.Errorf("Expected 3 env printers, got %d", len(envPrinters)) + // Should have Talos and Windsor (terraform not included in slice when disabled) + if len(envPrinters) != 2 { + t.Errorf("Expected 2 env printers, got %d", len(envPrinters)) } })