Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish FFI with children #1425

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/definitions/sender_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (ds *definitionSender) PublishFFI(ctx context.Context, name, version, netwo

var sender *sendWrapper
err = ds.database.RunAsGroup(ctx, func(ctx context.Context) error {
if ffi, err = ds.contracts.GetFFI(ctx, name, version); err != nil {
if ffi, err = ds.contracts.GetFFIWithChildren(ctx, name, version); err != nil {
return err
}
if ffi.Published {
Expand Down
10 changes: 5 additions & 5 deletions internal/definitions/sender_contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func TestPublishFFI(t *testing.T) {
}

ds.mdi.On("GetFFIByNetworkName", context.Background(), "ns1", "ffi1-shared", "1.0").Return(nil, nil)
ds.mcm.On("GetFFI", context.Background(), "ffi1", "1.0").Return(ffi, nil)
ds.mcm.On("GetFFIWithChildren", context.Background(), "ffi1", "1.0").Return(ffi, nil)
ds.mcm.On("ResolveFFI", context.Background(), ffi).Return(nil)
ds.mim.On("GetRootOrg", context.Background()).Return(&core.Identity{
IdentityBase: core.IdentityBase{
Expand Down Expand Up @@ -392,7 +392,7 @@ func TestPublishFFIAlreadyPublished(t *testing.T) {
Published: true,
}

ds.mcm.On("GetFFI", context.Background(), "ffi1", "1.0").Return(ffi, nil)
ds.mcm.On("GetFFIWithChildren", context.Background(), "ffi1", "1.0").Return(ffi, nil)
mockRunAsGroupPassthrough(ds.mdi)

_, err := ds.PublishFFI(context.Background(), "ffi1", "1.0", "ffi1-shared", false)
Expand All @@ -404,7 +404,7 @@ func TestPublishFFIQueryFail(t *testing.T) {
defer ds.cleanup(t)
ds.multiparty = true

ds.mcm.On("GetFFI", context.Background(), "ffi1", "1.0").Return(nil, fmt.Errorf("pop"))
ds.mcm.On("GetFFIWithChildren", context.Background(), "ffi1", "1.0").Return(nil, fmt.Errorf("pop"))
mockRunAsGroupPassthrough(ds.mdi)

_, err := ds.PublishFFI(context.Background(), "ffi1", "1.0", "ffi1-shared", false)
Expand All @@ -423,7 +423,7 @@ func TestPublishFFIResolveFail(t *testing.T) {
Published: false,
}

ds.mcm.On("GetFFI", context.Background(), "ffi1", "1.0").Return(ffi, nil)
ds.mcm.On("GetFFIWithChildren", context.Background(), "ffi1", "1.0").Return(ffi, nil)
ds.mcm.On("ResolveFFI", context.Background(), ffi).Return(fmt.Errorf("pop"))
mockRunAsGroupPassthrough(ds.mdi)

Expand All @@ -446,7 +446,7 @@ func TestPublishFFIPrepareFail(t *testing.T) {
}

ds.mdi.On("GetFFIByNetworkName", context.Background(), "ns1", "ffi1-shared", "1.0").Return(nil, nil)
ds.mcm.On("GetFFI", context.Background(), "ffi1", "1.0").Return(ffi, nil)
ds.mcm.On("GetFFIWithChildren", context.Background(), "ffi1", "1.0").Return(ffi, nil)
ds.mcm.On("ResolveFFI", context.Background(), ffi).Return(nil)
ds.mim.On("GetRootOrg", context.Background()).Return(&core.Identity{
IdentityBase: core.IdentityBase{
Expand Down
Loading