[WIP] test: run root test with build flag #500
Closed
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.
5 tests moved to build flag
internals/daemon
:TestUserGroup
internals/daemon
:TestUserIDGroupID
internals/daemon
:TestWriteUserGroupReal
internals/daemon
:TestMakeDirsUserGroupReal
internals/osutil
:TestMakeParentsChmodAndChown
TestUserGroup
andTestUserIDGroupID
are moved into a new fileinternals/daemon/api_exec_root_test.go
, and since they require some setup/teardown, I created aTestMain
func there.TestWriteUserGroupReal
andTestMakeDirsUserGroupReal
are moved into a separate new fileinternals/daemon/api_files_root_test.go
, they don't need setup, but because it's in the same package, there is a problem: theTestMain
from the other file still runs for these tests. The tests won't fail, but doing a non-required setup feels wrong.The only solution I can think of is to create a new folder, something like the integration tests and put
TestUserGroup
andTestUserIDGroupID
in one subfolder/package, and putTestWriteUserGroupReal
andTestMakeDirsUserGroupReal
into a different subfolder/package, so that theTestMain
func from one won't interfere with the other. Any better solution here?1 test not moved to build flag:
internals/overlord/servstate
:TestUserGroup
This is because the setup/teardown for this test is complicated, moving it to another new file basically means copy-pasting most parts of the existing setup/teardown code and rewriting them not using a suite. I did part of this and found it was too complicated so I gave it up and reverted the changes. Need some input here about this test.