Exemple #1
0
        public void TestDeleteComputeNodeUser()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string computeNodeId           = null;
            string userName = "******";

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-DeleteComputeNodeUser '{0}' '{1}' '{2}' '{3}'", accountName, poolId, computeNodeId, userName) }); },
                () =>
            {
                context       = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId);
                ScenarioTestHelpers.CreateComputeNodeUser(controller, context, poolId, computeNodeId, userName);
            },
                null,
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestListNodeFilesByComputeNodeRecursive()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string computeNodeId           = null;
            string startupFolder           = "startup";
            int    recursiveCount          = 5;// dir itself, ProcessEnv, stdout, stderr, wd

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListNodeFilesByComputeNodeRecursive '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, poolId, computeNodeId, startupFolder, recursiveCount) }); },
                () =>
            {
                context       = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId);
            },
                null,
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestListNodeFilesByComputeNodeByFilter()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string computeNodeId           = null;
            string nodeFilePrefix          = "s";
            int    matches = 2;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListNodeFilesByComputeNodeByFilter '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, poolId, computeNodeId, nodeFilePrefix, matches) }); },
                () =>
            {
                context       = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId);
            },
                null,
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #4
0
        public void TestGetPoolById()
        {
            BatchController     controller = BatchController.NewInstance;
            string              poolId     = "testGetPool";
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetPoolById '{0}' '{1}'", commonAccountName, poolId) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, commonAccountName);
                ScenarioTestHelpers.CreateTestPool(controller, context, poolId, 0);
            },
                () =>
            {
                ScenarioTestHelpers.DeletePool(controller, context, poolId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #5
0
        public void TestEvaluateAutoScaleByPipeline()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-EvaluateAutoScale '{0}' '{1}' '1'", commonAccountName, testPoolId) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, commonAccountName);
                ScenarioTestHelpers.EnableAutoScale(controller, context, testPoolId);
                ScenarioTestHelpers.WaitForSteadyPoolAllocation(controller, context, testPoolId);
            },
                () =>
            {
                ScenarioTestHelpers.DisableAutoScale(controller, context, testPoolId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #6
0
        public void TestGetAndListJobSchedulesWithSelect()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobScheduleId           = "selectTest";

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetAndListJobSchedulesWithSelect '{0}' '{1}'", accountName, jobScheduleId) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJobSchedule(controller, context, jobScheduleId, null);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJobSchedule(controller, context, jobScheduleId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #7
0
        private void TestTerminateJobSchedule(bool usePipeline)
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobScheduleId           = "testTerminateJobSchedule" + (usePipeline ? "Pipeline" : "Id");

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-TerminateJobSchedule '{0}' '{1}' '{2}'", accountName, jobScheduleId, usePipeline ? 1 : 0) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJobSchedule(controller, context, jobScheduleId, null);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJobSchedule(controller, context, jobScheduleId);
            },
                TestUtilities.GetCallingClass(),
                usePipeline ? "TestTerminateJobSchedulePipeline" : "TestTerminateJobScheduleById");
        }
Exemple #8
0
        public void TestCreateTask()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "createTaskJob";
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-CreateTask '{0}' '{1}'", accountName, jobId) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestGetAndListCertificatesWithSelect()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string thumbprint = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetAndListCertificatesWithSelect '{0}' '{1}' '{2}'", accountName, BatchTestHelpers.TestCertificateAlgorithm, thumbprint) }); },
                () =>
            {
                context    = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                thumbprint = ScenarioTestHelpers.AddTestCertificate(controller, context, BatchTestHelpers.TestCertificateFileName1);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteTestCertificate(controller, context, BatchTestHelpers.TestCertificateAlgorithm, thumbprint);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestGetWorkItemByName()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              workItemName = "testName";
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetWorkItemByName '{0}' '{1}'", accountName, workItemName) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #11
0
        public void TestUpdateTask()
        {
            BatchController controller = BatchController.NewInstance;
            string          jobId      = "updateTaskJob";
            string          taskId     = "testTask";

            BatchAccountContext context = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-UpdateTask '{0}' '{1}' '{2}'", accountName, jobId, taskId) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                // Make the task long running so the constraints can be updated
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, "ping -t localhost -w 60");
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestListNodeFilesByTaskWithMaxCount()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "nodeFileByTaskMaxJob";
            string              taskId     = "testTask";
            int                 maxCount   = 1;
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListNodeFilesByTaskWithMaxCount '{0}' '{1}' '{2}' '{3}'", accountName, jobId, taskId, maxCount) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId);
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestListNodeFilesByTaskRecursive()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "listNodeFileByTaskRecursiveJob";
            string              taskId     = "testTask";
            string              newFile    = "testFile.txt";
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListNodeFilesByTaskRecursive '{0}' '{1}' '{2}' '{3}'", accountName, jobId, taskId, newFile) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo \"test file\" > {0}", newFile));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #14
0
        public void TestListTaskPipeline()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              workItemName = "listTaskPipeWI";
            string              jobName      = null;
            string              taskName     = "testTask";
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListTaskPipeline '{0}' '{1}' '{2}' '{3}'", accountName, workItemName, jobName, taskName) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName);
                jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
                ScenarioTestHelpers.CreateTestTask(controller, context, workItemName, jobName, taskName);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }