Skip to content

Commit

Permalink
fix: workflowKey is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
agparadiso committed Nov 27, 2024
1 parent 32e1b15 commit e88867d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion core/services/feeds/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,11 @@ func (s *service) SyncNodeInfo(ctx context.Context, id int64) error {
cfgMsgs = append(cfgMsgs, cfgMsg)
}

workflowKey := s.getWorkflowPublicKey()
if _, err = fmsClient.UpdateNode(ctx, &pb.UpdateNodeRequest{
Version: s.version,
ChainConfigs: cfgMsgs,
WorkflowKey: s.getWorkflowPublicKey(),
WorkflowKey: &workflowKey,
}); err != nil {
return err
}
Expand Down
13 changes: 8 additions & 5 deletions core/services/feeds/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ func Test_Service_CreateChainConfig(t *testing.T) {
svc.orm.On("GetManager", mock.Anything, mgr.ID).Return(&mgr, nil)
svc.connMgr.On("GetClient", mgr.ID).Return(svc.fmsClient, nil)
svc.orm.On("ListChainConfigsByManagerIDs", mock.Anything, []int64{mgr.ID}).Return([]feeds.ChainConfig{cfg}, nil)
wkID := workflowKey.ID()
svc.fmsClient.On("UpdateNode", mock.Anything, &proto.UpdateNodeRequest{
Version: nodeVersion.Version,
ChainConfigs: []*proto.ChainConfig{
Expand All @@ -606,7 +607,7 @@ func Test_Service_CreateChainConfig(t *testing.T) {
Ocr2Config: &proto.OCR2Config{Enabled: false},
},
},
WorkflowKey: workflowKey.ID(),
WorkflowKey: &wkID,
}).Return(&proto.UpdateNodeResponse{}, nil)

actual, err := svc.CreateChainConfig(testutils.Context(t), cfg)
Expand Down Expand Up @@ -660,10 +661,11 @@ func Test_Service_DeleteChainConfig(t *testing.T) {
svc.orm.On("GetManager", mock.Anything, mgr.ID).Return(&mgr, nil)
svc.connMgr.On("GetClient", mgr.ID).Return(svc.fmsClient, nil)
svc.orm.On("ListChainConfigsByManagerIDs", mock.Anything, []int64{mgr.ID}).Return([]feeds.ChainConfig{}, nil)
wkID := workflowKey.ID()
svc.fmsClient.On("UpdateNode", mock.Anything, &proto.UpdateNodeRequest{
Version: nodeVersion.Version,
ChainConfigs: []*proto.ChainConfig{},
WorkflowKey: workflowKey.ID(),
WorkflowKey: &wkID,
}).Return(&proto.UpdateNodeResponse{}, nil)

actual, err := svc.DeleteChainConfig(testutils.Context(t), cfg.ID)
Expand Down Expand Up @@ -749,6 +751,7 @@ func Test_Service_UpdateChainConfig(t *testing.T) {
svc.orm.On("GetChainConfig", mock.Anything, cfg.ID).Return(&cfg, nil)
svc.connMgr.On("GetClient", mgr.ID).Return(svc.fmsClient, nil)
svc.orm.On("ListChainConfigsByManagerIDs", mock.Anything, []int64{mgr.ID}).Return([]feeds.ChainConfig{cfg}, nil)
wkID := workflowKey.ID()
svc.fmsClient.On("UpdateNode", mock.Anything, &proto.UpdateNodeRequest{
Version: nodeVersion.Version,
ChainConfigs: []*proto.ChainConfig{
Expand All @@ -765,7 +768,7 @@ func Test_Service_UpdateChainConfig(t *testing.T) {
Ocr2Config: &proto.OCR2Config{Enabled: false},
},
},
WorkflowKey: workflowKey.ID(),
WorkflowKey: &wkID,
}).Return(&proto.UpdateNodeResponse{}, nil)

actual, err := svc.UpdateChainConfig(testutils.Context(t), cfg)
Expand Down Expand Up @@ -1697,7 +1700,7 @@ func Test_Service_SyncNodeInfo(t *testing.T) {
svc.ocr1Keystore.On("Get", ocrKey.GetID()).Return(ocrKey, nil)

svc.workflowKeystore.On("GetAll").Return([]workflowkey.Key{workflowKey}, nil)

wkID := workflowKey.ID()
svc.fmsClient.On("UpdateNode", mock.Anything, &proto.UpdateNodeRequest{
Version: nodeVersion.Version,
ChainConfigs: []*proto.ChainConfig{
Expand Down Expand Up @@ -1738,7 +1741,7 @@ func Test_Service_SyncNodeInfo(t *testing.T) {
},
},
},
WorkflowKey: workflowKey.ID(),
WorkflowKey: &wkID,
}).Return(&proto.UpdateNodeResponse{}, nil)

err = svc.SyncNodeInfo(testutils.Context(t), mgr.ID)
Expand Down

0 comments on commit e88867d

Please sign in to comment.