DeleteJob() public static méthode

Deletes a job used in a Scenario test.
public static DeleteJob ( BatchController controller, BatchAccountContext context, string jobId ) : void
controller BatchController
context BatchAccountContext
jobId string
Résultat void
        public void TestListJobsUnderSchedule()
        {
            BatchController controller    = BatchController.NewInstance;
            string          jobScheduleId = "testJobSchedule";
            string          jobId         = null;
            string          jobId2        = null;
            string          runOnceJob    = "runOnceId";

            BatchAccountContext context = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListJobsUnderSchedule '{0}' '{1}' '{2}' '{3}'", accountName, jobScheduleId, jobId, 2) }); },
                () =>
            {
                TimeSpan recurrence = TimeSpan.FromMinutes(1);
                context             = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, runOnceJob);
                ScenarioTestHelpers.CreateTestJobSchedule(controller, context, jobScheduleId, recurrence);
                jobId = ScenarioTestHelpers.WaitForRecentJob(controller, context, jobScheduleId);
                ScenarioTestHelpers.TerminateJob(controller, context, jobId);
                jobId2 = ScenarioTestHelpers.WaitForRecentJob(controller, context, jobScheduleId, jobId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, runOnceJob);
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
                ScenarioTestHelpers.DeleteJob(controller, context, jobId2);
                ScenarioTestHelpers.DeleteJobSchedule(controller, context, jobScheduleId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestTerminateTask()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobId   = "testTerminateTaskJob";
            string taskId1 = "testTask1";
            string taskId2 = "testTask2";

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-TerminateTask '{0}' '{1}' '{2}'", jobId, taskId1, taskId2) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                // Make the tasks long running so they can be terminated before they finish execution
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId1, "ping -t localhost -w 60");
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId2, "ping -t localhost -w 60");
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestListNodeFilesByTaskByFilter()
        {
            BatchController     controller     = BatchController.NewInstance;
            string              jobId          = "listNodeFileByTaskFilterJob";
            string              taskId         = "testTask";
            string              nodeFilePrefix = "std";
            int                 matches        = 2;
            BatchAccountContext context        = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListNodeFilesByTaskByFilter '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, jobId, taskId, nodeFilePrefix, matches) }); },
                () =>
            {
                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());
        }
Exemple #4
0
        public void TestListTasksByFilter()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "filterTaskJob";
            string              taskId1    = "testTask1";
            string              taskId2    = "testTask2";
            string              taskId3    = "thirdTestTask";
            string              taskPrefix = "testTask";
            int                 matches    = 2;
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListTasksByFilter '{0}' '{1}' '{2}' '{3}'", accountName, jobId, taskPrefix, matches) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId1);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId2);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId3);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #5
0
        public void TestListAllTasks()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "listTaskJob";
            string              taskId1    = "testTask1";
            string              taskId2    = "testTask2";
            string              taskId3    = "testTask3";
            int                 count      = 3;
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListAllTasks '{0}' '{1}'", jobId, count) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId1);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId2);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId3);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #6
0
        public void TestGetNodeFileContentByTask()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              jobId        = "nodeFileContentByTask";
            string              taskId       = "testTask";
            string              fileName     = "testFile.txt";
            string              nodeFilePath = string.Format("wd\\{0}", fileName);
            string              fileContents = "test file contents";
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                _logger,
                () => { return(new string[] { string.Format("Test-GetNodeFileContentByTask '{0}' '{1}' '{2}' '{3}'", jobId, taskId, nodeFilePath, fileContents) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo {0} > {1}", fileContents, fileName));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                MethodBase.GetCurrentMethod().ReflectedType?.ToString(),
                MethodBase.GetCurrentMethod().Name);
        }
        public void TestListAllJobs()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId1     = "testId1";
            string              jobId2     = "testId2";
            string              jobId3     = "thirdtestId";
            int                 count      = 3;
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListAllJobs '{0}' '{1}'", accountName, count) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId1);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId2);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId3);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId1);
                ScenarioTestHelpers.DeleteJob(controller, context, jobId2);
                ScenarioTestHelpers.DeleteJob(controller, context, jobId3);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestDeleteNodeFileByTask()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobId    = "deletetaskFile";
            string taskId   = "task1";
            string fileName = "testFile.txt";
            string filePath = string.Format("wd\\{0}", fileName);

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-DeleteNodeFileByTask '{0}' '{1}' '{2}'", jobId, taskId, filePath) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo \"test\" > {0}", fileName));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestGetNodeFileContentByTaskPipeline()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              jobId        = "nodeFileContentByTaskPipe";
            string              taskId       = "testTask";
            string              fileName     = "testFile.txt";
            string              nodeFileName = string.Format("wd\\{0}", fileName);
            string              fileContents = "test file contents";
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetNodeFileContentByTaskPipeline '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, jobId, taskId, nodeFileName, fileContents) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo {0} > {1}", fileContents, fileName));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #10
0
        public void TestDeleteNodeFileByComputeNode()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobId         = "deleteNodeFile";
            string taskId        = "task1";
            string computeNodeId = null;
            string fileName      = "testFile.txt";
            string filePath      = string.Format("workitems\\{0}\\job-1\\{1}\\wd\\{2}", jobId, taskId, fileName);

            controller.RunPsTestWorkflow(
                _logger,
                () => { return(new string[] { string.Format("Test-DeleteNodeFileByComputeNode '{0}' '{1}' '{2}'", poolId, computeNodeId, filePath) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo \"test\" > {0}", fileName));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
                computeNodeId = ScenarioTestHelpers.GetTaskComputeNodeId(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                MethodBase.GetCurrentMethod().ReflectedType?.ToString(),
                MethodBase.GetCurrentMethod().Name);
        }
        public void TestListAllSubtasks()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              jobId        = "listSubtaskJob";
            string              taskId       = "testTask";
            int                 numInstances = 3;
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListAllSubtasks '{0}' '{1}' '{2}'", jobId, taskId, numInstances) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateMpiPoolIfNotExists(controller, context);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId, ScenarioTestHelpers.MpiPoolId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, "cmd /c hostname", numInstances);
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        private void TestDeleteNodeFileByComputeNode(bool usePipeline, string testMethodName)
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobId         = string.Format("deleteNodeByFileComputeNodeBy{0}", usePipeline ? "Pipeline" : "Name");
            string taskId        = "task1";
            string computeNodeId = null;
            string fileName      = "testFile.txt";
            string filePath      = string.Format("workitems\\{0}\\job-1\\{1}\\wd\\{2}", jobId, taskId, fileName);

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-DeleteNodeFileByComputeNode '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, poolId, computeNodeId, filePath, usePipeline ? "1" : "0") }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo \"test\" > {0}", fileName));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
                computeNodeId = ScenarioTestHelpers.GetTaskComputeNodeId(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                testMethodName);
        }
Exemple #13
0
        public void TestListJobsByFilter()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId1     = "filterTestId1";
            string              jobId2     = "filterTestId2";
            string              jobId3     = "thirdtestId";
            string              prefix     = "filterTest";
            int                 matches    = 2;
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListJobsByFilter '{0}' '{1}'", prefix, matches) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId1);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId2);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId3);
                ScenarioTestHelpers.TerminateJob(controller, context, jobId1);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId1);
                ScenarioTestHelpers.DeleteJob(controller, context, jobId2);
                ScenarioTestHelpers.DeleteJob(controller, context, jobId3);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #14
0
        private void TestTerminateJob(bool usePipeline)
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobId = "testTerminateJob" + (usePipeline ? "Pipeline" : "Id");

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-TerminateJob '{0}' '{1}' '{2}'", accountName, jobId, usePipeline ? 1 : 0) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                usePipeline ? "TestTerminateJobPipeline" : "TestTerminateJobById");
        }
Exemple #15
0
        public void TestGetAndListJobsWithSelect()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobId = "selectTest";

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

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-CreateTaskCollection '{0}'", jobId) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                MethodBase.GetCurrentMethod().ReflectedType?.ToString(),
                MethodBase.GetCurrentMethod().Name);
        }
        public void TestCreateTaskCollection()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "createTaskCollectionJob";
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-CreateTaskCollection '{0}'", jobId) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #18
0
        public void IfJobSetsAutoFailure_ItCompletesWhenAnyTaskFails()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string     jobId        = "testJobCompletesWhenTaskFails";
            string     taskId       = "taskId-1";
            PSCloudJob completedJob = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("IfJobSetsAutoFailure-ItCompletesWhenAnyTaskFails '{0}' '{1}'", jobId, taskId) }); },
                null,
                () =>
            {
                context      = new ScenarioTestContext();
                completedJob = ScenarioTestHelpers.WaitForJobCompletion(controller, context, jobId, taskId);
                AssertJobIsCompleteDueToTaskFailure(completedJob);
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #19
0
        public void TestGetTaskById()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "getTaskJob";
            string              taskId     = "testTask";
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetTaskById '{0}' '{1}' '{2}'", accountName, jobId, taskId) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #20
0
        public void IfJobSetsAutoFailure_ItCompletesWhenAnyTaskFails()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string     poolId       = "testPool";
            string     jobId        = "testJobCompletesWhenTaskFails";
            string     taskId       = "taskId-1";
            PSCloudJob completedJob = null;

            controller.RunPsTestWorkflow(
                _logger,
                () => { return(new string[] { string.Format("IfJobSetsAutoFailure-ItCompletesWhenAnyTaskFails '{0}' '{1}' '{2}'", poolId, jobId, taskId) }); },
                null,
                () =>
            {
                context      = new ScenarioTestContext();
                completedJob = ScenarioTestHelpers.WaitForJobCompletion(controller, context, jobId, taskId);
                AssertJobIsCompleteDueToTaskFailure(completedJob);
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                MethodBase.GetCurrentMethod().ReflectedType?.ToString(),
                MethodBase.GetCurrentMethod().Name);
        }
Exemple #21
0
        public void TestGetNodeFileByTaskByName()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              jobId        = "testGetNodeFileByTaskJob";
            string              taskId       = "testTask";
            string              nodeFileName = "stdout.txt";
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetNodeFileByTaskByName '{0}' '{1}' '{2}'", jobId, taskId, nodeFileName) }); },
                () =>
            {
                context = new ScenarioTestContext();
                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 #23
0
        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}'", jobId, taskId, maxCount) }); },
                () =>
            {
                context = new ScenarioTestContext();
                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 TestListNodeFileByTaskPipeline()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "nodeFileByTaskPipe";
            string              taskId     = "testTask";
            int                 count      = 4; // ProcessEnv, stdout, stderr, wd
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListNodeFileByTaskPipeline '{0}' '{1}' '{2}' '{3}'", accountName, jobId, taskId, count) }); },
                () =>
            {
                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());
        }
Exemple #25
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());
        }