This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Surinder Singh
committed
Oct 11, 2019
1 parent
4b20662
commit 29d73ab
Showing
3 changed files
with
40 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package flytek8s | ||
|
||
import ( | ||
"testing" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/lyft/flyteplugins/go/tasks/v1/types" | ||
) | ||
|
||
func TestRetrieveK8sObjectStatus(t *testing.T) { | ||
status := k8sObjectExists | ||
phase := types.TaskPhaseRunning | ||
customState := storeK8sObjectStatus(status, phase) | ||
|
||
retrievedStatus, retrievedPhase, err := retrieveK8sObjectStatus(customState) | ||
assert.NoError(t, err) | ||
assert.Equal(t, status, retrievedStatus) | ||
assert.Equal(t, phase, retrievedPhase) | ||
} | ||
|
||
func TestRetrieveK8sObjectStatus2(t *testing.T) { | ||
status := 2 | ||
phase := 4 | ||
customState := make(map[string]interface{}) | ||
customState[statusKey] = status | ||
customState[terminalTaskPhaseKey] = phase | ||
|
||
retrievedStatus, retrievedPhase, err := retrieveK8sObjectStatus(customState) | ||
assert.NoError(t, err) | ||
assert.Equal(t, status, int(retrievedStatus)) | ||
assert.Equal(t, phase, int(retrievedPhase)) | ||
} |
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