Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/transform/completion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
{
Expand All @@ -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",
Expand Down
24 changes: 10 additions & 14 deletions cmd/transform/listplugins/listplugins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/tests/mta_801_stateful_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/tests/mta_804_empty_pvc_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/tests/mta_806_pvc_data_integrity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/tests/mta_807_data_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/tests/mta_811_mongodb_non_admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/tests/mta_813_cronJob_PVC_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 2 additions & 0 deletions internal/plugin/plugin_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 We probably should add the logger to KubernetesPlugin too, commented it on migtools#494

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that would need a change in crane-lib first i think


paths := []string{absPathPluginDir, pluginDir, GlobalPluginDir, PkgPluginDir}

Expand Down
Loading