forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added capability to relaunch an execution (flyteorg#52)
* Added capability to relaunch an execution Signed-off-by: Prafulla Mahindrakar <[email protected]> * Added more coverage Signed-off-by: Prafulla Mahindrakar <[email protected]> * Moved around test function Signed-off-by: Prafulla Mahindrakar <[email protected]> * Added few more tests Signed-off-by: Prafulla Mahindrakar <[email protected]> * Using RelaunchExecution directly Signed-off-by: Prafulla Mahindrakar <[email protected]> * added comments for interface and renamed the file Signed-off-by: Prafulla Mahindrakar <[email protected]>
- Loading branch information
1 parent
468ce3e
commit c0858c2
Showing
17 changed files
with
413 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package create | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/flyteorg/flytectl/cmd/config" | ||
"github.com/flyteorg/flytectl/cmd/testutils" | ||
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin" | ||
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
var ( | ||
relaunchExecResponse *admin.ExecutionCreateResponse | ||
relaunchRequest *admin.ExecutionRelaunchRequest | ||
) | ||
|
||
// This function needs to be called after testutils.Steup() | ||
func createExecutionUtilSetup() { | ||
ctx = testutils.Ctx | ||
cmdCtx = testutils.CmdCtx | ||
mockClient = testutils.MockClient | ||
relaunchExecResponse = &admin.ExecutionCreateResponse{ | ||
Id: &core.WorkflowExecutionIdentifier{ | ||
Project: "flytesnacks", | ||
Domain: "development", | ||
Name: "f652ea3596e7f4d80a0e", | ||
}, | ||
} | ||
relaunchRequest = &admin.ExecutionRelaunchRequest{ | ||
Id: &core.WorkflowExecutionIdentifier{ | ||
Name: "execName", | ||
Project: config.GetConfig().Project, | ||
Domain: config.GetConfig().Domain, | ||
}, | ||
} | ||
} | ||
|
||
func TestCreateExecutionForRelaunch(t *testing.T) { | ||
setup() | ||
createExecutionUtilSetup() | ||
mockClient.OnRelaunchExecutionMatch(ctx, relaunchRequest).Return(relaunchExecResponse, nil) | ||
err = relaunchExecution(ctx, "execName", config.GetConfig().Project, config.GetConfig().Domain, cmdCtx) | ||
assert.Nil(t, err) | ||
} | ||
|
||
func TestCreateExecutionForRelaunchNotFound(t *testing.T) { | ||
setup() | ||
createExecutionUtilSetup() | ||
mockClient.OnRelaunchExecutionMatch(ctx, relaunchRequest).Return(nil, errors.New("unknown execution")) | ||
err = relaunchExecution(ctx, "execName", config.GetConfig().Project, config.GetConfig().Domain, cmdCtx) | ||
assert.NotNil(t, err) | ||
assert.Equal(t, err, errors.New("unknown execution")) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.