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

make blip tests fail with stack traces using testify #6748

Merged
merged 3 commits into from
Apr 2, 2024
Merged

Conversation

torcolvin
Copy link
Collaborator

This is really only to help debug the CBG-3818 ticket part 1, I have a second round of refactoring just for this test to see what documents aren't coming through.

  • Create TB() helper functions to make it easier to pick up the right TB function since it can get reset or hard to pick up
  • use require.EventuallyT instead of testing.T.Fatalf to get tracebacks when they fail. Because these functions fail anyway, removed the return of boolean found.
  • switch panic to require statements in code
  • remove return statements if the test would fail anyway

To review:

  • Did I do the removal of the error status correctly, are there any cases where the removal of an argument actually used?
  • Did I remove any assertions?
  • Do the new assertion messages make sense?

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Integration Tests

- Create TB() helper functions to make it easier to pick up the right
  TB function since it can get reset or hard to pick up
- use require.EventuallyT instead of testing.T.Fatalf to get tracebacks
  when they fail. Because these functions fail anyway, removed the
  return of boolean found.
- switch panic to require statements while the code was here
gregns1
gregns1 previously approved these changes Apr 2, 2024
Copy link
Contributor

@gregns1 gregns1 left a comment

Choose a reason for hiding this comment

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

Looks good, just some nitpicks. I have approved as its good as is to be merged given its test code and there is no real functional impacts of my comments. Feel free to merge as is.

@@ -2257,8 +2257,7 @@ func TestRevocationMessage(t *testing.T) {
assert.NoError(t, err)

// Wait for doc revision to come over
_, ok := btcRunner.WaitForBlipRevMessage(btc.id, "doc", version)
require.True(t, ok)
_ = btcRunner.WaitForBlipRevMessage(btc.id, "doc", version)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Do we need to have the empty return values on these in this file? Could keep it in line with what you have done in most other places and not have the empty return values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

WaitForBlipRevMessage does use return value in blip_api_delta_sync_test.go

Copy link
Contributor

Choose a reason for hiding this comment

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

What I meant was you could have btcRunner.WaitForBlipRevMessage(btc.id, "doc", version) as opposed to _ = btcRunner.WaitForBlipRevMessage(btc.id, "doc", version)
It doesn't have any impact on tests so i'm good merging, was just a nitpick.

@@ -2040,8 +2035,7 @@ func TestRemovedMessageWithAlternateAccess(t *testing.T) {

err = btcRunner.StartOneshotPull(btc.id)
assert.NoError(t, err)
_, ok := btcRunner.WaitForVersion(btc.id, docID, version)
assert.True(t, ok)
_ = btcRunner.WaitForVersion(btc.id, docID, version)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Same as above in this file too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

WaitForMessage return values are used in blip_api_delta_sync_test.go

rest/blip_client_test.go Outdated Show resolved Hide resolved
@torcolvin torcolvin merged commit 405aa8e into master Apr 2, 2024
29 of 30 checks passed
@torcolvin torcolvin deleted the CBG-3818 branch April 2, 2024 16:02
bbrks pushed a commit that referenced this pull request Apr 3, 2024
* Cleanup tests

- Create TB() helper functions to make it easier to pick up the right
  TB function since it can get reset or hard to pick up
- use require.EventuallyT instead of testing.T.Fatalf to get tracebacks
  when they fail. Because these functions fail anyway, removed the
  return of boolean found.
- switch panic to require statements
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.

2 participants