Skip to content

Commit

Permalink
fix the nil pointer in the integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed Oct 2, 2024
1 parent 66ec3ce commit 5cf39e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pkg/storage/utils/decomposedfs/decomposedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1284,9 +1284,14 @@ func (fs *Decomposedfs) refFromNode(ctx context.Context, n *node.Node, storageId

func (fs *Decomposedfs) publishEvent(ctx context.Context, evf func() (any, error)) {
log := appctx.GetLogger(ctx)
if fs.stream == nil {
log.Error().Msg("Failed to publish event, stream is undefined")
return
}
ev, err := evf()
if err != nil {
if err != nil || ev == nil {
log.Error().Err(err).Msg("Failed to crete the event")
return
}
if err := events.Publish(ctx, fs.stream, ev); err != nil {
log.Error().Err(err).Msg("Failed to publish event")
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/grpc/storageprovider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,17 @@ var _ = Describe("storage providers", func() {
}

assertMove := func(provider string) {
It("moves a directory", func() {
FIt("moves a directory", func() {
subdirRef := ref(provider, subdirPath)
statRes, err := providerClient.Stat(ctx, &storagep.StatRequest{Ref: subdirRef})
Expect(err).ToNot(HaveOccurred())
Expect(statRes.Status.Code).To(Equal(rpcv1beta1.Code_CODE_OK))

targetRef := &storagep.Reference{ResourceId: subdirRef.ResourceId, Path: "/new_subdir"}
res, err := providerClient.Move(ctx, &storagep.MoveRequest{Source: subdirRef, Destination: targetRef})
Expect(res.Status.Code).To(Equal(rpcv1beta1.Code_CODE_OK))

Expect(err).ToNot(HaveOccurred())
Expect(res.GetStatus().GetCode()).To(Equal(rpcv1beta1.Code_CODE_OK))

statRes, err = providerClient.Stat(ctx, &storagep.StatRequest{Ref: subdirRef})
Expect(err).ToNot(HaveOccurred())
Expand Down

0 comments on commit 5cf39e1

Please sign in to comment.