diff --git a/cmd/transform/completion_test.go b/cmd/transform/completion_test.go index 1d8a1507..7296bb18 100644 --- a/cmd/transform/completion_test.go +++ b/cmd/transform/completion_test.go @@ -43,7 +43,7 @@ func TestGetPluginCompletions(t *testing.T) { args: []string{}, toComplete: "", wantDirective: cobra.ShellCompDirectiveNoFileComp, - wantPlugins: []string{"KubernetesPlugin"}, // Default plugin is always present + wantPlugins: []string{"KubernetesPlugin", "OpenShiftPlugin"}, // Built-in plugins are always present checkContains: true, }, { @@ -66,7 +66,7 @@ func TestGetPluginCompletions(t *testing.T) { args: []string{}, toComplete: "", wantDirective: cobra.ShellCompDirectiveNoFileComp, - wantPlugins: []string{}, // KubernetesPlugin skipped, so empty + wantPlugins: []string{"OpenShiftPlugin"}, // KubernetesPlugin skipped, OpenShiftPlugin remains }, { name: "error path - plugin-dir flag does not exist", diff --git a/cmd/transform/listplugins/listplugins_test.go b/cmd/transform/listplugins/listplugins_test.go index 387c24a9..5da40c3f 100644 --- a/cmd/transform/listplugins/listplugins_test.go +++ b/cmd/transform/listplugins/listplugins_test.go @@ -21,59 +21,55 @@ func TestGetPluginNames(t *testing.T) { wantErr bool }{ { - name: "empty plugin directory returns only default plugin", + name: "empty plugin directory returns built-in plugins", setupPlugins: func(t *testing.T, pluginDir string) { - // Create empty plugin directory if err := os.MkdirAll(pluginDir, 0755); err != nil { t.Fatalf("failed to create plugin dir: %v", err) } }, skipPlugins: []string{}, - wantNames: []string{"KubernetesPlugin"}, // Default plugin is always included + wantNames: []string{"KubernetesPlugin", "OpenShiftPlugin"}, wantErr: false, }, { - name: "skip default plugin", + name: "skip KubernetesPlugin leaves OpenShiftPlugin", setupPlugins: func(t *testing.T, pluginDir string) { if err := os.MkdirAll(pluginDir, 0755); err != nil { t.Fatalf("failed to create plugin dir: %v", err) } }, skipPlugins: []string{"KubernetesPlugin"}, - wantNames: []string{}, + wantNames: []string{"OpenShiftPlugin"}, wantErr: false, }, { - name: "nonexistent plugin directory", + name: "nonexistent plugin directory returns built-in plugins", setupPlugins: func(t *testing.T, pluginDir string) { // Don't create the directory }, skipPlugins: []string{}, - wantNames: []string{"KubernetesPlugin"}, // Default plugin is still included + wantNames: []string{"KubernetesPlugin", "OpenShiftPlugin"}, wantErr: false, }, { - name: "plugin directory with mock plugins", + name: "plugin directory with no external plugins returns built-ins", setupPlugins: func(t *testing.T, pluginDir string) { if err := os.MkdirAll(pluginDir, 0755); err != nil { t.Fatalf("failed to create plugin dir: %v", err) } - // Note: We can't easily test with real plugin binaries in unit tests - // This test verifies the function works with an empty directory - // Integration tests would be needed for testing with actual plugin binaries }, skipPlugins: []string{}, - wantNames: []string{"KubernetesPlugin"}, + wantNames: []string{"KubernetesPlugin", "OpenShiftPlugin"}, wantErr: false, }, { - name: "skip multiple plugins", + name: "skip both built-in plugins", setupPlugins: func(t *testing.T, pluginDir string) { if err := os.MkdirAll(pluginDir, 0755); err != nil { t.Fatalf("failed to create plugin dir: %v", err) } }, - skipPlugins: []string{"KubernetesPlugin", "NonExistentPlugin"}, + skipPlugins: []string{"KubernetesPlugin", "OpenShiftPlugin"}, wantNames: []string{}, wantErr: false, }, diff --git a/e2e-tests/tests/mta_801_stateful_migration_test.go b/e2e-tests/tests/mta_801_stateful_migration_test.go index 791de7dd..39d3adf1 100644 --- a/e2e-tests/tests/mta_801_stateful_migration_test.go +++ b/e2e-tests/tests/mta_801_stateful_migration_test.go @@ -13,6 +13,7 @@ import ( var _ = Describe("Stateful app migration", func() { It("[MTA-801] Migrate all of PVCs that are associated with quiesced resource", Label("tier0"), func() { + Skip("transfer-pvc command not available in mta-crane") appName := "redis" namespace := appName scenario := NewMigrationScenario( diff --git a/e2e-tests/tests/mta_804_empty_pvc_migration_test.go b/e2e-tests/tests/mta_804_empty_pvc_migration_test.go index 2abfcd14..d3c9d36c 100644 --- a/e2e-tests/tests/mta_804_empty_pvc_migration_test.go +++ b/e2e-tests/tests/mta_804_empty_pvc_migration_test.go @@ -13,6 +13,7 @@ import ( var _ = Describe("Empty PVC migration", func() { It("[MTA-804] Migrate an empty PVC associated with an application", Label("tier0"), func() { + Skip("transfer-pvc command not available in mta-crane") appName := "app-with-empty-pvc" namespace := appName scenario := NewMigrationScenario( diff --git a/e2e-tests/tests/mta_806_pvc_data_integrity_test.go b/e2e-tests/tests/mta_806_pvc_data_integrity_test.go index 4ce82e81..46ea28e4 100644 --- a/e2e-tests/tests/mta_806_pvc_data_integrity_test.go +++ b/e2e-tests/tests/mta_806_pvc_data_integrity_test.go @@ -14,6 +14,7 @@ import ( var _ = Describe("PVC data integrity migration", func() { It("[MTA-806] Migrate a PVC with data and verify checksum integrity", Label("tier0"), func() { + Skip("transfer-pvc command not available in mta-crane") const testFileName = "testfile.txt" appName := "app-with-empty-pvc" namespace := appName diff --git a/e2e-tests/tests/mta_807_data_validation_test.go b/e2e-tests/tests/mta_807_data_validation_test.go index 4d241f63..382cc8ce 100644 --- a/e2e-tests/tests/mta_807_data_validation_test.go +++ b/e2e-tests/tests/mta_807_data_validation_test.go @@ -119,6 +119,7 @@ func mysqlTestDataMD5(k KubectlRunner, namespace, podName string) (actual string var _ = Describe("Data validation with indirect migration of MySQL DB", func() { It("[BUG #213][MTA-807] Should validate data", Label("BUG #213", "tier0"), func() { + Skip("transfer-pvc command not available in mta-crane") appName := "mysql" namespace := appName scenario := NewMigrationScenario( diff --git a/e2e-tests/tests/mta_811_mongodb_non_admin_test.go b/e2e-tests/tests/mta_811_mongodb_non_admin_test.go index 903d5b67..d715094e 100644 --- a/e2e-tests/tests/mta_811_mongodb_non_admin_test.go +++ b/e2e-tests/tests/mta_811_mongodb_non_admin_test.go @@ -97,6 +97,7 @@ func mongoDocumentCount(k KubectlRunner, namespace, podName string) (int, error) var _ = Describe("MongoDB Migration", func() { It("[BUG #213][MTA-811] Should migrate a MongoDB resource with data intact as nonadmin user", Label("BUG #213", "tier0"), func() { + Skip("transfer-pvc command not available in mta-crane") appName := "mongodb" namespace := appName scenario := NewMigrationScenario( diff --git a/e2e-tests/tests/mta_813_cronJob_PVC_test.go b/e2e-tests/tests/mta_813_cronJob_PVC_test.go index e0ac22e5..8c2f5a39 100644 --- a/e2e-tests/tests/mta_813_cronJob_PVC_test.go +++ b/e2e-tests/tests/mta_813_cronJob_PVC_test.go @@ -13,6 +13,7 @@ import ( var _ = Describe("CronJob with attached PVC migration as non-admin user", func() { It("[BUG #330][BUG #408][MTA-813] Should migrate a cronjob and its attached PVC as a namespace-admin user", Label("BUG #330", "BUG #408", "tier0"), func() { + Skip("transfer-pvc command not available in mta-crane") appName := "cronjob" namespace := "mta-813-ns" expectedLogSubstring := fmt.Sprintf("Hello! from namespace %s", namespace) diff --git a/go.mod b/go.mod index 561c7fd0..785be61f 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/google/go-cmp v0.7.0 github.com/jarcoal/httpmock v1.2.0 github.com/konveyor/crane-lib v0.1.6-0.20260414113823-a9f07d55042b + github.com/migtools/crane-plugin-openshift v0.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/onsi/ginkgo/v2 v2.28.1 github.com/onsi/gomega v1.39.0 diff --git a/go.sum b/go.sum index f44d5577..fba79d42 100644 --- a/go.sum +++ b/go.sum @@ -378,6 +378,8 @@ github.com/maxatome/go-testdeep v1.11.0/go.mod h1:011SgQ6efzZYAen6fDn4BqQ+lUR72y github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3vE= github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/migtools/crane-plugin-openshift v0.1.0 h1:HLjKpUoS5Nw+al/H5iBkU+uVCvr2Kg00hkhv6djWVBE= +github.com/migtools/crane-plugin-openshift v0.1.0/go.mod h1:wFdbjNnSn8tSen9oYy8769ivLmwAS3TFL34H1jfSeFw= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= diff --git a/internal/plugin/plugin_helper.go b/internal/plugin/plugin_helper.go index aba5155f..0744f212 100644 --- a/internal/plugin/plugin_helper.go +++ b/internal/plugin/plugin_helper.go @@ -9,6 +9,7 @@ import ( "github.com/konveyor/crane-lib/transform" binary_plugin "github.com/konveyor/crane-lib/transform/binary-plugin" "github.com/konveyor/crane-lib/transform/kubernetes" + "github.com/migtools/crane-plugin-openshift/openshift" "github.com/sirupsen/logrus" ) @@ -73,6 +74,7 @@ func GetFilteredPlugins(pluginDir string, skipPlugins []string, logger *logrus.L // Start with built-in plugins unfilteredPlugins = append(unfilteredPlugins, &kubernetes.KubernetesTransformPlugin{}) + unfilteredPlugins = append(unfilteredPlugins, &openshift.OpenShiftTransformPlugin{Log: logger}) paths := []string{absPathPluginDir, pluginDir, GlobalPluginDir, PkgPluginDir}