Skip to content

Commit cf790e6

Browse files
author
Rohit-PX
committed
mock test
Signed-off-by: Rohit-PX <rkulkarni@purestorage.com>
1 parent 7ebf946 commit cf790e6

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

test/integration_test/migration_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func testMigration(t *testing.T) {
5555
err = setSourceKubeConfig()
5656
require.NoError(t, err, "failed to set kubeconfig to source cluster: %v", err)
5757

58+
t.Run("migrationStatsExportTest", migrationStatsExportTest)
5859
t.Run("deploymentTest", deploymentMigrationTest)
5960
t.Run("deploymentMigrationReverseTest", deploymentMigrationReverseTest)
6061
t.Run("statefulsetTest", statefulsetMigrationTest)
@@ -1549,3 +1550,36 @@ func transformResourceTest(t *testing.T) {
15491550
require.NoError(t, err, "failed to set kubeconfig to source cluster: %v", err)
15501551
validateAndDestroyMigration(t, ctxs, preMigrationCtx, true, false, true, false, true)
15511552
}
1553+
1554+
func migrationStatsExportTest(t *testing.T) {
1555+
var err error
1556+
// Reset config in case of error
1557+
defer func() {
1558+
err = setSourceKubeConfig()
1559+
require.NoError(t, err, "Error resetting source config")
1560+
}()
1561+
1562+
migrationKey := "mysql-migration"
1563+
migrationAppKey := "mysql-1-pvc"
1564+
1565+
currCtxs, err := schedulerDriver.Schedule(migrationKey,
1566+
scheduler.ScheduleOptions{AppKeys: []string{migrationAppKey}})
1567+
require.NoError(t, err, "Error scheduling task")
1568+
require.Equal(t, 1, len(currCtxs), "Only one task should have started")
1569+
1570+
err = schedulerDriver.WaitForRunning(currCtxs[0], defaultWaitTimeout, defaultWaitInterval)
1571+
require.NoError(t, err, "Error waiting for app to get to running state")
1572+
1573+
// create, apply and validate cluster pair specs
1574+
err = scheduleClusterPair(currCtxs[0], false, true, defaultClusterPairDir, "", false)
1575+
require.NoError(t, err, "Error scheduling cluster pair")
1576+
ctxs = append(ctxs, currCtxs...)
1577+
1578+
currMigNamespace := migrationAppKey + "-" + migrationKey
1579+
currMig, err := createMigration(t, migrationKey, currMigNamespace, "remoteclusterpair", currMigNamespace, &includeResourcesFlag, &startApplicationsFlag)
1580+
require.NoError(t, err, "failed to create migration: %s in namespace %s", migrationKey, currMigNamespace)
1581+
1582+
migrationList := []*v1alpha1.Migration{icurrMig}
1583+
err = WaitForMigration(allMigrations)
1584+
require.NoError(t, err, "Error in scaled migrations")
1585+
}

0 commit comments

Comments
 (0)