-
Notifications
You must be signed in to change notification settings - Fork 51
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
ci: Parallelize change detector #1871
ci: Parallelize change detector #1871
Conversation
… init logic. add data format documentation checks
…nted and getDatabaseFormatDocumentation
Codecov ReportPatch coverage has no change and project coverage change:
@@ Coverage Diff @@
## develop #1871 +/- ##
===========================================
- Coverage 70.31% 70.30% -0.01%
===========================================
Files 232 232
Lines 24192 24192
===========================================
- Hits 17010 17007 -3
- Misses 6021 6023 +2
- Partials 1161 1162 +1
Flags with carried forward coverage won't be shown. Click here to find out more. see 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestChanges(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: I really like this approach, it is simpler and neater than some kind of file lock IMO.
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package change_detector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion(non-blocking, minor): Whilst I like the approach, I do dislike that this test will be executed by default with go test ./...
, I think it might be nicer if we exclude this test by default, perhaps using a build flag. This would however complicate the github action matrix stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added build tag here and updated Makefile to include --tags change_detector
.
Makefile
Outdated
@@ -294,8 +295,7 @@ test\:coverage-html: | |||
|
|||
.PHONY: test\:changes | |||
test\:changes: | |||
@$(MAKE) deps:lens | |||
env DEFRA_DETECT_DATABASE_CHANGES=true DEFRA_CLIENT_GO=true gotestsum -- ./... -shuffle=on -p 1 | |||
gotestsum --format testname -- ./$(CHANGE_DETECTOR_TEST_DIRECTORY)/... -shuffle=on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: It does look like -shuffle=on
adds no value here? Or is it passed down into the child tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed shuffle flag.
tests/integration/utils2.go
Outdated
@@ -202,7 +155,7 @@ func init() { | |||
// | |||
// Usage: AssertPanicAndSkipChangeDetection(t, func() { executeTestCase(t, test) }) | |||
func AssertPanicAndSkipChangeDetection(t *testing.T, f assert.PanicTestFunc) bool { | |||
if IsDetectingDbChanges() { | |||
if change_detector.Enabled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Perhaps a non-snake case package name or import alias name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to changeDetector
with an alias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do really like these changes, specially the clean isolation of change detection test under the test/
folder and ability to specify source
and target
in a clean manner.
I've updated it to default to the local repo if |
|
||
var targetRepoDir string | ||
if targetBranch == "" { | ||
// default to the local branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: This seems odd and a bit dangerous no? If I understand correctly this will now default to testing against itself, which is essentially the same as running go test ./...
?
This does seem like an easy way to accidentally not run the change detector at all.
EDIT: I misunderstood, we now have source and target branches, and the new source branch is what the old target used to be. Ignore this comment :)
…ream defradb repo. update checkIfDatabaseFormatChangesAreDocumented to use source and target directories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: were you able to introduce breaking changes locally and test that the change detector actually catches the breaking change?
No, but I can do that and report back. Update: I was able to get it to fail, but it's also failing on this test case which should be passing.
|
After some further digging I've verified that this test is not correctly persisting the document from the setup phase. If this is a blocker for merging I can look into fixing it in a new PR. |
I don't see that as a blocker as long as change detection works. Going to review one last time and give an LGTM in a few minutes |
For clarification #1897 fixed this failing test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
nitpick: Slight preference for the PR title to be a |
## Relevant issue(s) Closes #1472 Closes #1507 Closes #1860 ## Description This is a follow up to #1776 This PR adds a CLI implementation that implements the client.DB interface and runs through the existing integration test suite. - [x] Merge existing server config code - [x] Refactor CLI to use new HTTP client - [x] Remove `net/api` package - [x] Remove `api/http` package - [x] Lens tests are timing out in CI: fixed #1862 - [x] Code coverage is incorrectly reporting: fixed #1861 - [x] Flaky test causing failures: fixed #1912 Renamed Commands: - `peerid` to `client peer info` - `client p2pcollection` to `client p2p collection` - `client replicator` to `client p2p replicator` - `client schema list` to `client collection describe` Removed Commands: - `block get` - `ping` - `rpc` Added Commands: - `client collection create` - `client collection delete` - `client collection get` - `client collection keys` - `client collection update` - `client tx create` - `client tx discard` - `client tx commit` - `client schema migration up` - `client schema migration down` - `client schema migration reload` **Notes for reviewers**: - `.github` changes are merged from #1871 - `Makefile` most of these changes are also from #1871 - `docs/cli` ignore these changes, it will be updated next release - sorry for all of the merge commits, I am working on learning rebase flow ## Tasks - [x] I made sure the code is well commented, particularly hard-to-understand areas. - [x] I made sure the repository-held documentation is changed accordingly. - [x] I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in [tools/configs/chglog/config.yml](tools/configs/chglog/config.yml)). - [x] I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ... ## How has this been tested? `make test` Specify the platform(s) on which this was tested: - MacOS
## Relevant issue(s) Resolves sourcenetwork#1436 ## Description This PR allows the change detector to run in parallel with other tests. There are also a few other improvements to the change detector: - change detector logic is moved to a new `tests/change_detector` package - change detector specific logic in `tests/integration` is now more obvious - change detector now operates on distinct `source` and `target` branches - this enables you to test branches outside of the currently checked out branch - change detector manages its own environment variables. - running `go test ./tests/change_detector/...` will work without env variables - change detector temp directories are now all cleaned up after running Todo before merging: - [x] update default branch and repository - [x] document change detector data format changes ## Tasks - [x] I made sure the code is well commented, particularly hard-to-understand areas. - [x] I made sure the repository-held documentation is changed accordingly. - [x] I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in [tools/configs/chglog/config.yml](tools/configs/chglog/config.yml)). - [x] I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ... ## How has this been tested? `make test:changes` Specify the platform(s) on which this was tested: - MacOS
## Relevant issue(s) Closes sourcenetwork#1472 Closes sourcenetwork#1507 Closes sourcenetwork#1860 ## Description This is a follow up to sourcenetwork#1776 This PR adds a CLI implementation that implements the client.DB interface and runs through the existing integration test suite. - [x] Merge existing server config code - [x] Refactor CLI to use new HTTP client - [x] Remove `net/api` package - [x] Remove `api/http` package - [x] Lens tests are timing out in CI: fixed sourcenetwork#1862 - [x] Code coverage is incorrectly reporting: fixed sourcenetwork#1861 - [x] Flaky test causing failures: fixed sourcenetwork#1912 Renamed Commands: - `peerid` to `client peer info` - `client p2pcollection` to `client p2p collection` - `client replicator` to `client p2p replicator` - `client schema list` to `client collection describe` Removed Commands: - `block get` - `ping` - `rpc` Added Commands: - `client collection create` - `client collection delete` - `client collection get` - `client collection keys` - `client collection update` - `client tx create` - `client tx discard` - `client tx commit` - `client schema migration up` - `client schema migration down` - `client schema migration reload` **Notes for reviewers**: - `.github` changes are merged from sourcenetwork#1871 - `Makefile` most of these changes are also from sourcenetwork#1871 - `docs/cli` ignore these changes, it will be updated next release - sorry for all of the merge commits, I am working on learning rebase flow ## Tasks - [x] I made sure the code is well commented, particularly hard-to-understand areas. - [x] I made sure the repository-held documentation is changed accordingly. - [x] I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in [tools/configs/chglog/config.yml](tools/configs/chglog/config.yml)). - [x] I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ... ## How has this been tested? `make test` Specify the platform(s) on which this was tested: - MacOS
Relevant issue(s)
Resolves #1436
Description
This PR allows the change detector to run in parallel with other tests.
There are also a few other improvements to the change detector:
tests/change_detector
packagetests/integration
is now more obvioussource
andtarget
branchesgo test ./tests/change_detector/...
will work without env variablesTodo before merging:
Tasks
How has this been tested?
make test:changes
Specify the platform(s) on which this was tested: