Skip to content

Commit f42d778

Browse files
authored
Merge pull request containerd#3609 from apostasie/series-7
Rewrite diff tests & minor ignore file tweak
2 parents 9821b3b + 2336d3d commit f42d778

File tree

3 files changed

+60
-46
lines changed

3 files changed

+60
-46
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
_output
44

55
# golangci-lint
6-
build
6+
/build
77

88
# vagrant
99
/.vagrant

cmd/nerdctl/container/container_diff_linux_test.go

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
Copyright The containerd Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package container
18+
19+
import (
20+
"testing"
21+
22+
"github.com/containerd/nerdctl/v2/pkg/testutil"
23+
"github.com/containerd/nerdctl/v2/pkg/testutil/nerdtest"
24+
"github.com/containerd/nerdctl/v2/pkg/testutil/test"
25+
)
26+
27+
func TestDiff(t *testing.T) {
28+
testCase := nerdtest.Setup()
29+
30+
// It is unclear why this is failing with docker when run in parallel
31+
// Obviously some other container test is interfering
32+
if nerdtest.IsDocker() {
33+
testCase.NoParallel = true
34+
}
35+
36+
testCase.Require = test.Not(test.Windows)
37+
38+
testCase.Setup = func(data test.Data, helpers test.Helpers) {
39+
helpers.Ensure("run", "-d", "--name", data.Identifier(), testutil.CommonImage,
40+
"sh", "-euxc", "touch /a; touch /bin/b; rm /bin/base64")
41+
}
42+
43+
testCase.Cleanup = func(data test.Data, helpers test.Helpers) {
44+
helpers.Anyhow("rm", "-f", data.Identifier())
45+
}
46+
47+
testCase.Command = func(data test.Data, helpers test.Helpers) test.TestableCommand {
48+
return helpers.Command("diff", data.Identifier())
49+
}
50+
51+
testCase.Expected = test.Expects(0, nil, test.All(
52+
test.Contains("A /a"),
53+
test.Contains("C /bin"),
54+
test.Contains("A /bin/b"),
55+
test.Contains("D /bin/base64"),
56+
))
57+
58+
testCase.Run(t)
59+
}

0 commit comments

Comments
 (0)