-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- For the UpsertPatchAsset RPC, when no upstreams and downstreams are specified in the request, skip overwriting the asset's lineage unless OverwriteLineage flag is set to true. - Bump up the proton commit in Makefile to pull in changes from raystack/proton#238 + generate protos.
- Loading branch information
1 parent
7df7acd
commit a587fff
Showing
9 changed files
with
1,467 additions
and
1,211 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
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 |
---|---|---|
|
@@ -678,6 +678,97 @@ func TestUpsertPatchAsset(t *testing.T) { | |
|
||
}, | ||
}, | ||
{ | ||
Description: "without explicit overwrite_lineage, should upsert asset without lineage", | ||
Setup: func(ctx context.Context, as *mocks.AssetService) { | ||
patchedAsset := asset.Asset{ | ||
URN: "test dagger", | ||
Type: asset.TypeTable, | ||
Name: "new-name", | ||
Service: "kafka", | ||
UpdatedBy: user.User{ID: userID}, | ||
Data: map[string]interface{}{}, | ||
Owners: []user.User{{ID: "id", UUID: "", Email: "[email protected]", Provider: "provider"}}, | ||
} | ||
|
||
assetWithID := patchedAsset | ||
assetWithID.ID = assetID | ||
|
||
as.EXPECT().GetAssetByID(ctx, "test dagger").Return(currentAsset, nil) | ||
as.EXPECT().UpsertAssetWithoutLineage(ctx, &patchedAsset). | ||
Return(assetWithID.ID, nil). | ||
Run(func(ctx context.Context, ast *asset.Asset) { | ||
patchedAsset.ID = assetWithID.ID | ||
}) | ||
}, | ||
Request: &compassv1beta1.UpsertPatchAssetRequest{ | ||
Asset: &compassv1beta1.UpsertPatchAssetRequest_Asset{ | ||
Urn: "test dagger", | ||
Type: "table", | ||
Name: wrapperspb.String("new-name"), | ||
Service: "kafka", | ||
Data: &structpb.Struct{}, | ||
Owners: []*compassv1beta1.User{{Id: "id", Uuid: "", Email: "[email protected]", Provider: "provider"}}, | ||
}, | ||
}, | ||
ExpectStatus: codes.OK, | ||
PostCheck: func(resp *compassv1beta1.UpsertPatchAssetResponse) error { | ||
expected := &compassv1beta1.UpsertPatchAssetResponse{ | ||
Id: assetID, | ||
} | ||
if diff := cmp.Diff(resp, expected, protocmp.Transform()); diff != "" { | ||
return fmt.Errorf("expected response to be %+v, was %+v", expected, resp) | ||
} | ||
return nil | ||
|
||
}, | ||
}, | ||
{ | ||
Description: "with explicit overwrite_lineage, should upsert asset when lineage is not in the request", | ||
Setup: func(ctx context.Context, as *mocks.AssetService) { | ||
patchedAsset := asset.Asset{ | ||
URN: "test dagger", | ||
Type: asset.TypeTable, | ||
Name: "new-name", | ||
Service: "kafka", | ||
UpdatedBy: user.User{ID: userID}, | ||
Data: map[string]interface{}{}, | ||
Owners: []user.User{{ID: "id", UUID: "", Email: "[email protected]", Provider: "provider"}}, | ||
} | ||
|
||
assetWithID := patchedAsset | ||
assetWithID.ID = assetID | ||
|
||
as.EXPECT().GetAssetByID(ctx, "test dagger").Return(currentAsset, nil) | ||
as.EXPECT().UpsertAsset(ctx, &patchedAsset, []string{}, []string{}). | ||
Return(assetWithID.ID, nil). | ||
Run(func(ctx context.Context, ast *asset.Asset, _, _ []string) { | ||
patchedAsset.ID = assetWithID.ID | ||
}) | ||
}, | ||
Request: &compassv1beta1.UpsertPatchAssetRequest{ | ||
Asset: &compassv1beta1.UpsertPatchAssetRequest_Asset{ | ||
Urn: "test dagger", | ||
Type: "table", | ||
Name: wrapperspb.String("new-name"), | ||
Service: "kafka", | ||
Data: &structpb.Struct{}, | ||
Owners: []*compassv1beta1.User{{Id: "id", Uuid: "", Email: "[email protected]", Provider: "provider"}}, | ||
}, | ||
OverwriteLineage: true, | ||
}, | ||
ExpectStatus: codes.OK, | ||
PostCheck: func(resp *compassv1beta1.UpsertPatchAssetResponse) error { | ||
expected := &compassv1beta1.UpsertPatchAssetResponse{ | ||
Id: assetID, | ||
} | ||
if diff := cmp.Diff(resp, expected, protocmp.Transform()); diff != "" { | ||
return fmt.Errorf("expected response to be %+v, was %+v", expected, resp) | ||
} | ||
return nil | ||
|
||
}, | ||
}, | ||
} | ||
for _, tc := range testCases { | ||
t.Run(tc.Description, func(t *testing.T) { | ||
|
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.