test: add unit tests for goctl docker command (PR #4343) #5241
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unit Tests for PR #4343
This PR adds comprehensive unit tests for the
goctl docker
command to verify the fixes introduced in PR #4343.Related PR
Tests Added
Test File:
tools/goctl/docker/docker_test.go
(376 lines, 25 test cases)Test Functions:
TestDockerCommand_EtcDirResolution
- Validates etc directory resolution logicTestGenerateDockerfile_GoMainFromPath
- Validates GoMainFrom path generationTestGenerateDockerfile_PathJoinBehavior
- Demonstrates bug and fixTestFindConfig
- Tests config file discoveryTestGetFilePath
- Tests file path resolutionTestDockerCommandIntegration
- Integration testsTestPR4343_BugFixes
- Specific validation for PR fix: ensure Dockerfile includes etc directory and correct CMD based on config #4343Test Results
tools/goctl/docker
directoryBugs Validated
The tests clearly demonstrate and validate the fixes for:
Bug 1: Incorrect etc directory detection
Bug 2: Path duplication in GoMainFrom
How to Test
Recommendation
Should be merged together with or after PR #4343 to ensure the fixes are properly validated and prevent future regressions.