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

fix: change return value of ListContentAtACL and write test for it #1373

Open
wants to merge 2 commits into
base: zkevm
Choose a base branch
from

Conversation

jhkimqd
Copy link

@jhkimqd jhkimqd commented Oct 29, 2024

This PR introduces a few important changes to the ListContentAtACL function:

  • Previously, the return value of ListContentAtACL was dynamic, and there were 756 unique combinations for the output (5, 2, 2). The nature of the db query could not be changed, but to make this much more predictable and testable, the previous return value has been split into 4 different strings - all combined to return a []string. The slice of strings contains the original output, in addition to three other outputs, separated by the table names:
    • combinedBuffers = append(combinedBuffers, buffer.String())
      combinedBuffers = append(combinedBuffers, bufferConfig.String())
      combinedBuffers = append(combinedBuffers, bufferBlockList.String())
      combinedBuffers = append(combinedBuffers, bufferAllowlist.String())
  • The above change allows the function to be testable by not looking at all the possible combinations, but by looking at the individual table outputs, and checking whether the mocked values exist using strings.Contains

Signed-off-by: Ji Hwan <jkim@polygon.technology>
@cla-bot cla-bot bot added the cla-signed label Oct 29, 2024
@jhkimqd jhkimqd requested review from cffls and afa7789 October 29, 2024 10:45
@jhkimqd jhkimqd marked this pull request as draft October 29, 2024 14:28
Signed-off-by: Ji Hwan <jkim@polygon.technology>
@jhkimqd jhkimqd marked this pull request as ready for review October 29, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant