diff --git a/flytepropeller/pkg/controller/executors/execution_context_test.go b/flytepropeller/pkg/controller/executors/execution_context_test.go index 3639057074..6a1561ea7c 100644 --- a/flytepropeller/pkg/controller/executors/execution_context_test.go +++ b/flytepropeller/pkg/controller/executors/execution_context_test.go @@ -63,3 +63,32 @@ func TestExecutionContext(t *testing.T) { assert.Equal(t, typed.TaskDetailsGetter, taskGetter) assert.Equal(t, typed.GetParentInfo(), immutableParentInfo2) } + +func TestParentExecutionInfo_GetUniqueID(t *testing.T) { + expectedID := "testID" + parentInfo := NewParentInfo(expectedID, 1) + assert.Equal(t, expectedID, parentInfo.GetUniqueID()) +} + +func TestParentExecutionInfo_CurrentAttempt(t *testing.T) { + expectedAttempt := uint32(123465) + parentInfo := NewParentInfo("testID", expectedAttempt) + assert.Equal(t, expectedAttempt, parentInfo.CurrentAttempt()) +} + +func TestControlFlow_ControlFlowParallelism(t *testing.T) { + cFlow := InitializeControlFlow().(*controlFlow) + assert.Equal(t, uint32(0), cFlow.CurrentParallelism()) + cFlow.IncrementParallelism() + assert.Equal(t, uint32(1), cFlow.CurrentParallelism()) + cFlow.IncrementParallelism() + assert.Equal(t, uint32(2), cFlow.CurrentParallelism()) +} + +func TestNewParentInfo(t *testing.T) { + expectedID := "testID" + expectedAttempt := uint32(123465) + parentInfo := NewParentInfo(expectedID, expectedAttempt).(*parentExecutionInfo) + assert.Equal(t, expectedID, parentInfo.uniqueID) + assert.Equal(t, expectedAttempt, parentInfo.currentAttempts) +} diff --git a/flytepropeller/pkg/controller/executors/node_lookup_test.go b/flytepropeller/pkg/controller/executors/node_lookup_test.go index 889ea62236..885c3262c4 100644 --- a/flytepropeller/pkg/controller/executors/node_lookup_test.go +++ b/flytepropeller/pkg/controller/executors/node_lookup_test.go @@ -48,3 +48,18 @@ func TestNewTestNodeLookup(t *testing.T) { assert.False(t, ok) assert.NotEqual(t, ns, nl.GetNodeExecutionStatus(context.TODO(), "n")) } + +func TestToNodeAndFromNode(t *testing.T) { + n := &mocks.ExecutableNode{} + ns := &mocks.ExecutableNodeStatus{} + nl := NewTestNodeLookup(map[string]v1alpha1.ExecutableNode{"n1": n}, map[string]v1alpha1.ExecutableNodeStatus{"n1": ns}) + + nodeIds, err := nl.ToNode("n1") + assert.Nil(t, nodeIds) + assert.Nil(t, err) + + nodeIds, err = nl.FromNode("n1") + assert.Nil(t, nodeIds) + assert.Nil(t, err) + +}