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

feat(metadata)!: replace REST device validation callback with MessageBus #4366

Merged
merged 2 commits into from
Feb 22, 2023
Merged

Conversation

chr1shung
Copy link
Member

BREAKING CHANGE: adding new device requires device service running

closes #4236

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-go/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)

Testing Instructions

See edgexfoundry/device-sdk-go#1325

New Dependency Instructions (If applicable)

@codecov-commenter
Copy link

codecov-commenter commented Feb 16, 2023

Codecov Report

Merging #4366 (ffb0bc6) into main (76c26b6) will increase coverage by 0.00%.
The diff coverage is 0.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##             main    #4366   +/-   ##
=======================================
  Coverage   43.71%   43.71%           
=======================================
  Files         116      116           
  Lines       10713    10712    -1     
=======================================
  Hits         4683     4683           
+ Misses       5610     5609    -1     
  Partials      420      420           
Impacted Files Coverage Δ
internal/core/metadata/application/device.go 0.00% <0.00%> (ø)
internal/core/metadata/application/notify.go 40.65% <0.00%> (+0.44%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

internal/core/metadata/application/notify.go Outdated Show resolved Hide resolved
}
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
jsonData, err := json.Marshal(testCase.request)
require.NoError(t, err)

var responseEnvelope types.MessageEnvelope
mockMessaging := &messagingMocks.MessageClient{}
mockMessaging.On("Publish", mock.Anything, mock.Anything).Return(nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is mock on Publish needed here? Request encapsulates it, should mocking Request will keep it from actually being called.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called in valid case for publishing system event.
I added ffb0bc6 to better test this behavior

internal/core/metadata/controller/http/device_test.go Outdated Show resolved Hide resolved
Chris Hung added 2 commits February 22, 2023 12:04
BREAKING CHANGE: adding new device requires device service running

closes #4236

Signed-off-by: Chris Hung <chris@iotechsys.com>
to actually test the message bus behavior

Signed-off-by: Chris Hung <chris@iotechsys.com>
@sonarcloud
Copy link

sonarcloud bot commented Feb 22, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lenny-goodell lenny-goodell merged commit 15b3f24 into edgexfoundry:main Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Device Validation callback with MessageBus Request/Response
3 participants