Skip to content

Migrating tests related to SG Logs#295

Merged
vipbhardwaj merged 6 commits intomainfrom
test_log_redaction_partial
Nov 7, 2025
Merged

Migrating tests related to SG Logs#295
vipbhardwaj merged 6 commits intomainfrom
test_log_redaction_partial

Conversation

@vipbhardwaj
Copy link
Contributor

This test is a step by step migration of the this test in the old framework.

This function tests Sync Gateway's log redaction feature. It configures Sync Gateway with different logging levels and verifies that sensitive data is tagged appropriately ('ud' tags for partial) when log redaction is enabled. The test creates a user, adds documents with xattrs, and checks the logs for the correct tagging based on the configured redaction level.

  1. Have sync_gateway config file with logging level as partial/none
  2. Restart sync_gateway
  3. Create user in sync_gateway
  4. Create docs with xattrs
  5. Verify data which is partial sensitive is tagged with 'ud' tags for partial and no ud tags if it is configured with None

Copy link
Member

@borrrden borrrden left a comment

Choose a reason for hiding this comment

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

This would be a bit more robust if you did not hard code the log path. You can pull the logging directory from the SG config first to know where it is without hard coding.

Copy link

@RIT3shSapata RIT3shSapata left a comment

Choose a reason for hiding this comment

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

Similar observations as PR #294 . Please create a sync function that assigns the channel to the documents and use the Public API to get the documents using the created user. Currently the all_docs endpoint is accessed via the Admin API which would use Adminstrator user instead of vipul user. This test still passes because all the users are redacted.

@vipbhardwaj vipbhardwaj changed the title Finished the test in the new file. Related to verification log capturing sensitive data Migrating tests related to SG Logs Nov 6, 2025
@vipbhardwaj vipbhardwaj force-pushed the test_log_redaction_partial branch from fe1a87c to f44b68b Compare November 6, 2025 16:30
@vipbhardwaj
Copy link
Contributor Author

Hey @borrrden , @RIT3shSapata
I have added fixes related to both of your comments. Kindly approve the PR.
Also this PR depended on one of the changes merged in the previous PR and that got me into such a weird rebasing situation where suddenly new mypy errors started popping and hence there are 4-5 new commits that would've not been there otherwise.

This is the one and only flaw of having smaller multiple PRs I feel 😢

Copy link

@RIT3shSapata RIT3shSapata left a comment

Choose a reason for hiding this comment

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

LGTM

@borrrden
Copy link
Member

borrrden commented Nov 6, 2025

Don't worry about having lots of commits in a PR, they will be squashed anyway

"types-requests==2.32.0.20241016",
"types-netifaces==0.11.0.20241025"
"types-netifaces==0.11.0.20241025",
"types-paramiko"
Copy link
Member

Choose a reason for hiding this comment

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

This should have a pinned version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was rejecting pinned versions, I tried with 2 different valid versions but I kept getting the error :

  × No solution found when resolving dependencies:
  ╰─▶ Because there is no version of types-paramiko==3.5.0.20241016 and
      cbltest[dev]==1.2.2 depends on types-paramiko==3.5.0.20241016, we can
      conclude that cbltest[dev]==1.2.2 cannot be used.
      And because only cbltest[dev]==1.2.2 is available and you require
      cbltest[dev], we can conclude that your requirements are unsatisfiable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you point me to a pinned version that would work?

Copy link
Member

Choose a reason for hiding this comment

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

What version gets installed when you just install it normally? I usually copy that. The latest 3.5.0 for that is 3.5.0.20250801 though

…old tests too, was erased due to the rebase 12hrs ago
@vipbhardwaj vipbhardwaj merged commit 6c85512 into main Nov 7, 2025
4 checks passed
@vipbhardwaj vipbhardwaj deleted the test_log_redaction_partial branch November 7, 2025 07:07
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.

3 participants