-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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: Write config to temp folder instead #21631
Conversation
WalkthroughWalkthroughThe changes involve modifications to the Changes
Sequence Diagram(s)sequenceDiagram
participant Test
participant TempDir
participant Config
Test->>TempDir: Create temporary directory
TempDir-->>Test: Return tempDirPath
Test->>Config: Write configuration to tempDirPath/config.toml
Test->>Config: Read configuration from tempDirPath/config.toml
Config-->>Test: Return configuration data
Test->>TempDir: Cleanup temporary directory
Tip Announcements
Recent review detailsConfiguration used: .coderabbit.yml Files selected for processing (1)
Additional context usedPath-based instructions (1)
Additional comments not posted (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
@@ -75,12 +75,11 @@ func TestServer(t *testing.T) { | |||
require.Equal(t, serverCfgs[mockServer.Name()].(*mockServerConfig).MockFieldOne, MockServerDefaultConfig().MockFieldOne) | |||
|
|||
// write config | |||
err = server.WriteConfig(configPath) | |||
tempDir := t.TempDir() |
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 think the test makes less sense now because, we read from testdata
(see configPath
) and eventually write to a temporary location and read it back and do more assertion.
So testdata would need to be manually updated if there is a change.
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.
That was the goal to not write to the testdata folder. Otherwise the file get's added to a PR by mistake easily and causes other tests to fail later due to concurrent access. I have run into this in a PR as well as Marko. The root cause was not easy to find.
The test still confirms that a pre-defined app.toml
can be imported and that an exported app.toml
can be imported again. I hope this adds more context and explains my motivation. WDYT?
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.
Supersede by #21645.
The test was just missing a server, so this is why it wasn't rendering the same file.
I still think we should write it to disk.
ref: #21631 (comment) |
Description
The
TestServer
test writes to thetestdata
folder which is easily added and causes failures later.With this PR, the config file is written to a temp folder instead.
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit
Bug Fixes
Tests