-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yee Hing Tong <[email protected]>
- Loading branch information
1 parent
fdd8fe9
commit 8a895b9
Showing
14 changed files
with
255 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package artifacts | ||
|
||
import ( | ||
"context" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestEmpty(t *testing.T) { | ||
c := InitializeArtifactClient(context.Background(), nil) | ||
assert.Nil(t, c) | ||
} |
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,28 @@ | ||
package artifacts | ||
|
||
import ( | ||
"context" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestRegistryNoClient(t *testing.T) { | ||
r := NewArtifactRegistry(context.Background(), nil) | ||
assert.Nil(t, r.GetClient()) | ||
} | ||
|
||
type Parent struct { | ||
R *ArtifactRegistry | ||
} | ||
|
||
func TestPointerReceivers(t *testing.T) { | ||
p := Parent{} | ||
nilClient := p.R.GetClient() | ||
assert.Nil(t, nilClient) | ||
} | ||
|
||
func TestNilCheck(t *testing.T) { | ||
r := NewArtifactRegistry(context.Background(), nil) | ||
err := r.RegisterTrigger(context.Background(), nil) | ||
assert.NotNil(t, err) | ||
} |
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,63 @@ | ||
package impl | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/flyteorg/flyte/flyteadmin/pkg/artifacts" | ||
eventWriterMocks "github.com/flyteorg/flyte/flyteadmin/pkg/async/events/mocks" | ||
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" | ||
mockScope "github.com/flyteorg/flyte/flytestdlib/promutils" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestResolveNotWorking(t *testing.T) { | ||
mockConfig := getMockExecutionsConfigProvider() | ||
|
||
execManager := NewExecutionManager(nil, nil, mockConfig, nil, mockScope.NewTestScope(), mockScope.NewTestScope(), nil, nil, nil, nil, nil, nil, &eventWriterMocks.WorkflowExecutionEventWriter{}, artifacts.NewArtifactRegistry(context.Background(), nil)).(*ExecutionManager) | ||
|
||
pm, artifactIDs, err := execManager.ResolveParameterMapArtifacts(context.Background(), nil, nil) | ||
assert.Nil(t, err) | ||
fmt.Println(pm, artifactIDs) | ||
|
||
} | ||
|
||
func TestTrackingBitExtract(t *testing.T) { | ||
mockConfig := getMockExecutionsConfigProvider() | ||
|
||
execManager := NewExecutionManager(nil, nil, mockConfig, nil, mockScope.NewTestScope(), mockScope.NewTestScope(), nil, nil, nil, nil, nil, nil, &eventWriterMocks.WorkflowExecutionEventWriter{}, artifacts.NewArtifactRegistry(context.Background(), nil)).(*ExecutionManager) | ||
|
||
lit := core.Literal{ | ||
Value: &core.Literal_Scalar{ | ||
Scalar: &core.Scalar{ | ||
Value: &core.Scalar_Primitive{ | ||
Primitive: &core.Primitive{ | ||
Value: &core.Primitive_Integer{ | ||
Integer: 1, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
Metadata: map[string]string{"_ua": "proj/domain/name@version"}, | ||
} | ||
inputMap := core.LiteralMap{ | ||
Literals: map[string]*core.Literal{ | ||
"a": &lit, | ||
}, | ||
} | ||
inputColl := core.LiteralCollection{ | ||
Literals: []*core.Literal{ | ||
&lit, | ||
}, | ||
} | ||
|
||
trackers := execManager.ExtractArtifactKeys(&lit) | ||
assert.Equal(t, 1, len(trackers)) | ||
|
||
trackers = execManager.ExtractArtifactKeys(&core.Literal{Value: &core.Literal_Map{Map: &inputMap}}) | ||
assert.Equal(t, 1, len(trackers)) | ||
trackers = execManager.ExtractArtifactKeys(&core.Literal{Value: &core.Literal_Collection{Collection: &inputColl}}) | ||
assert.Equal(t, 1, len(trackers)) | ||
assert.Equal(t, "proj/domain/name@version", trackers[0]) | ||
} |
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.