-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Ensure container tests do not write on the host #1661
Merged
cyphar
merged 1 commit into
opencontainers:master
from
masters-of-cats:tests-do-not-write-on-host
Nov 27, 2017
Merged
Ensure container tests do not write on the host #1661
cyphar
merged 1 commit into
opencontainers:master
from
masters-of-cats:tests-do-not-write-on-host
Nov 27, 2017
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hqhq
reviewed
Nov 23, 2017
libcontainer/container_linux_test.go
Outdated
|
||
rootDir, err := ioutil.TempDir("", "") | ||
if err != nil { | ||
t.Fatal("failed") |
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.
You can just print the error with t.Fatal(err)
.
cyphar
reviewed
Nov 23, 2017
libcontainer/container_linux_test.go
Outdated
@@ -281,8 +282,16 @@ func TestGetContainerStateAfterUpdate(t *testing.T) { | |||
if err != nil { | |||
t.Fatal(err) | |||
} | |||
|
|||
rootDir, err := ioutil.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.
Please give it a prefix. If you can't think of one make it just the test name.
TestGetContainerStateAfterUpdate creates its state.json file on the current directory which turns out to be the host runc directory. Thus whenever the test completes it leaves the state.json file behind thus a) poluting the local git repository b) changing the host file system violating the principle of doing everything in an isolated container environment This change would create a new temporary (in-container) directory and use it as linuxContainer.root Signed-off-by: Tom Godkin <tgodkin@pivotal.io>
danail-branekov
force-pushed
the
tests-do-not-write-on-host
branch
from
November 27, 2017 08:44
82b03f6
to
0495fec
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TestGetContainerStateAfterUpdate creates its state.json file on the current
directory which turns out to be the host runc directory. Thus whenever
the test completes it leaves the state.json file behind thus
a) poluting the local git repository
b) changing the host file system violating the principle of doing
everything in an isolated container environment
This change would create a new temporary (in-container) directory and use it as
linuxContainer.root
Signed-off-by: Tom Godkin tgodkin@pivotal.io