|
17 | 17 | using System;
|
18 | 18 | using System.Security.Cryptography.Xml;
|
19 | 19 | using System.Threading.Tasks;
|
| 20 | +using Amazon.Runtime.Internal.Transform; |
20 | 21 | using Microsoft.Extensions.Logging;
|
21 | 22 | using Monai.Deploy.WorkflowManager.Common.Interfaces;
|
22 | 23 | using Monai.Deploy.WorkflowManager.Contracts.Models;
|
@@ -535,5 +536,97 @@ public async Task ValidateWorkflow_ValidateWorkflow_ReturnsNoErrors()
|
535 | 536 | Assert.True(errors.Count == 0);
|
536 | 537 | }
|
537 | 538 | }
|
| 539 | + |
| 540 | + [Fact] |
| 541 | + public async Task ValidateWorkflow_Incorrect_podPriorityClassName_ReturnsErrors() |
| 542 | + { |
| 543 | + var workflow = new Workflow |
| 544 | + { |
| 545 | + Name = "Workflowname1", |
| 546 | + Description = "Workflowdesc1", |
| 547 | + Version = "1", |
| 548 | + InformaticsGateway = new InformaticsGateway |
| 549 | + { |
| 550 | + AeTitle = "aetitle", |
| 551 | + ExportDestinations = new string[] { "oneDestination", "twoDestination", "threeDestination" } |
| 552 | + }, |
| 553 | + Tasks = new TaskObject[] |
| 554 | + { |
| 555 | + new TaskObject |
| 556 | + { |
| 557 | + Args = new System.Collections.Generic.Dictionary<string, string>{ |
| 558 | + { "priority" ,"god" }, |
| 559 | + { "workflow_template_name" ,"spot"} |
| 560 | + }, |
| 561 | + Id = "rootTask", |
| 562 | + Type = "argo", |
| 563 | + Description = "TestDesc", |
| 564 | + Artifacts = new ArtifactMap |
| 565 | + { |
| 566 | + Input = new Artifact[]{ |
| 567 | + new Artifact |
| 568 | + { |
| 569 | + Name = "non_unique_artifact", |
| 570 | + Value = "Example Value" |
| 571 | + } |
| 572 | + } |
| 573 | + } |
| 574 | + }, |
| 575 | + } |
| 576 | + }; |
| 577 | + |
| 578 | + _workflowService.Setup(w => w.GetByNameAsync(It.IsAny<string>())) |
| 579 | + .ReturnsAsync(null, TimeSpan.FromSeconds(.1)); |
| 580 | + |
| 581 | + var errors = await _workflowValidator.ValidateWorkflow(workflow); |
| 582 | + |
| 583 | + Assert.Single(errors); |
| 584 | + } |
| 585 | + |
| 586 | + [Fact] |
| 587 | + public async Task ValidateWorkflow_correct_podPriorityClassName_ReturnsNoErrors() |
| 588 | + { |
| 589 | + var workflow = new Workflow |
| 590 | + { |
| 591 | + Name = "Workflowname1", |
| 592 | + Description = "Workflowdesc1", |
| 593 | + Version = "1", |
| 594 | + InformaticsGateway = new InformaticsGateway |
| 595 | + { |
| 596 | + AeTitle = "aetitle", |
| 597 | + ExportDestinations = new string[] { "oneDestination", "twoDestination", "threeDestination" } |
| 598 | + }, |
| 599 | + Tasks = new TaskObject[] |
| 600 | + { |
| 601 | + new TaskObject |
| 602 | + { |
| 603 | + Args = new System.Collections.Generic.Dictionary<string, string>{ |
| 604 | + { "priority" ,"high" }, |
| 605 | + { "workflow_template_name" ,"spot"} |
| 606 | + }, |
| 607 | + Id = "rootTask", |
| 608 | + Type = "argo", |
| 609 | + Description = "TestDesc", |
| 610 | + Artifacts = new ArtifactMap |
| 611 | + { |
| 612 | + Input = new Artifact[]{ |
| 613 | + new Artifact |
| 614 | + { |
| 615 | + Name = "non_unique_artifact", |
| 616 | + Value = "Example Value" |
| 617 | + } |
| 618 | + } |
| 619 | + } |
| 620 | + }, |
| 621 | + } |
| 622 | + }; |
| 623 | + |
| 624 | + _workflowService.Setup(w => w.GetByNameAsync(It.IsAny<string>())) |
| 625 | + .ReturnsAsync(null, TimeSpan.FromSeconds(.1)); |
| 626 | + |
| 627 | + var errors = await _workflowValidator.ValidateWorkflow(workflow); |
| 628 | + |
| 629 | + Assert.Empty(errors); |
| 630 | + } |
538 | 631 | }
|
539 | 632 | }
|
0 commit comments