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

test(sdk): Use -race Flag when testing #1026

Merged
merged 1 commit into from
Jan 25, 2022

Conversation

AlexCuse
Copy link
Contributor

Includes naive fix for one race detected.

Fixes #209

Signed-off-by: Alex Ullrich [email protected]

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/app-functions-sdk-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?)
    • unit tests sufficient
  • I have opened a PR for the related docs change (if not, why?)
    no docs change

Testing Instructions

New Dependency Instructions (If applicable)

Makefile Outdated
@@ -34,7 +34,7 @@ test-template:
make -C ./app-service-template test

test-sdk:
$(GO) test ./... -coverprofile=coverage.out ./...
$(GO) test ./... -coverprofile=coverage.out ./... -race
Copy link
Member

Choose a reason for hiding this comment

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

This looks strange... with the double ./... that was there before. In edgex-go it looks like this:

GOTESTFLAGS?=-race
.
.
.
GO111MODULE=on go test $(GOTESTFLAGS) -coverprofile=coverage.out ./...

Please use the edgex-go way of doing it.

Copy link
Member

Choose a reason for hiding this comment

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

Also this should be added to the Makefile for the app-service-template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I wondered what that was about @lenny-intel - should be good now thanks

@@ -59,7 +59,7 @@ docker:
# The test-attribution-txt.sh scripts are required for upstreaming to EdgeX Foundry.
# TODO: Remove bin folder and reference to script below if NOT upstreaming to EdgeX Foundry.
test:
$(GO) test -coverprofile=coverage.out ./...
$(GO) test -coverprofile=coverage.out ./... --race
Copy link
Member

@lenny-goodell lenny-goodell Jan 25, 2022

Choose a reason for hiding this comment

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

Still not consistent with edgex-go. Use variable and position of opinion. Please update to use:

GOTESTFLAGS?=-race


$(GO) test $(GOTESTFLAGS) -coverprofile=coverage.out ./...

Copy link
Member

Choose a reason for hiding this comment

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

Includes naive fix for one race detected.

Fixes #209

Signed-off-by: Alex Ullrich <[email protected]>
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 ec717f4 into edgexfoundry:main Jan 25, 2022
FelixTing pushed a commit to FelixTing/app-functions-sdk-go that referenced this pull request Mar 3, 2022
Includes naive fix for one race detected.

Fixes edgexfoundry#209

Signed-off-by: Alex Ullrich <[email protected]>
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.

Tests should run cleanly when passed the "-race" argument
2 participants