public void VerifyPathTimeIsEqualToOfficialBuildTimeWhenThereAreNoOutgoingEdges() { var node = new DependencyFlowNode("test", "test", Guid.NewGuid().ToString()) { OfficialBuildTime = 100.0, OutgoingEdges = new List <DependencyFlowEdge>() }; node.CalculateLongestPathTime(); node.WorstCasePathTime.Should().Be(node.OfficialBuildTime); node.BestCasePathTime.Should().Be(node.OfficialBuildTime); }
public static FlowRef Create(DependencyFlowNode other) { return(new FlowRef( other.Id, other.Repository, other.Branch, other.OfficialBuildTime, other.PrBuildTime, other.OnLongestBuildPath, other.BestCasePathTime, other.WorstCasePathTime, other.GoalTimeInMinutes)); }
public void VerifyPathTimeIsCorrectForOutgoingProductNodes() { var node = new DependencyFlowNode("test", "test", Guid.NewGuid().ToString()) { OfficialBuildTime = 100.0, }; var edge1 = AddEdge(node, worstCasePathTime: 10, bestCasePathTime: 5, prBuildTime: 1, isToolingOnlyEdge: false); var edge2 = AddEdge(node, worstCasePathTime: 20, bestCasePathTime: 2, prBuildTime: 1, isToolingOnlyEdge: false); node.CalculateLongestPathTime(); node.WorstCasePathTime.Should().Be(node.OfficialBuildTime + edge2.To.WorstCasePathTime + edge2.To.PrBuildTime); node.BestCasePathTime.Should().Be(node.OfficialBuildTime + edge1.To.BestCasePathTime); }
private DependencyFlowEdge AddEdge( DependencyFlowNode fromNode, double worstCasePathTime, double bestCasePathTime, double prBuildTime, bool isToolingOnlyEdge) { var toNode = new DependencyFlowNode("test", "test", Guid.NewGuid().ToString()) { BestCasePathTime = bestCasePathTime, PrBuildTime = prBuildTime, WorstCasePathTime = worstCasePathTime, }; var subscription = new Subscription(Guid.NewGuid(), true, "source", "target", "test"); subscription.LastAppliedBuild = new Build( id: 1, dateProduced: DateTimeOffset.Now, staleness: 0, released: false, stable: true, commit: "7a7e5c82abd287262a6efaf29902bb84a7bd81af", channels: ImmutableList <Channel> .Empty, assets: ImmutableList <Asset> .Empty, dependencies: new List <BuildRef> { new BuildRef(buildId: 1, isProduct: !isToolingOnlyEdge, timeToInclusionInMinutes: 1) }.ToImmutableList(), incoherencies: ImmutableList <BuildIncoherence> .Empty); var edge = new DependencyFlowEdge(fromNode, toNode, subscription) { IsToolingOnly = isToolingOnlyEdge }; fromNode.OutgoingEdges.Add(edge); return(edge); }
/// <summary> /// If pruning the graph is desired, determine whether a node is interesting. /// </summary> /// <param name="node">Node</param> /// <returns>True if the node is interesting, false otherwise</returns> private bool IsInterestingNode(Channel targetChannel, DependencyFlowNode node) { return node.OutputChannels.Any(c => c == targetChannel.Name); }
/// <summary> /// Calculate a validate graphviz node name for a dependency flow node /// </summary> /// <param name="node">Node</param> /// <returns>Valid node name string with repo and branch</returns> public static string CalculateGraphVizNodeName(DependencyFlowNode node) { return(CalculateGraphVizNodeName(GetSimpleRepoName(node.Repository) + node.Branch)); }