test: refactor container_run_linux_test.go to use Tigron#5071
Conversation
|
Marking as a draft, as CI including lint is failing. |
a46f144 to
5fda100
Compare
AkihiroSuda
left a comment
There was a problem hiding this comment.
Please squash the commits
|
|
||
| // Was thinking of os.ReadLink("/proc/1/ns/uts") | ||
| // but you'd get EPERM for rootless. Just validate the | ||
| // hostname is the same. |
There was a problem hiding this comment.
The comment strings should be preserved
| } | ||
|
|
||
| func TestRunAddHost(t *testing.T) { | ||
| // Not parallelizable (https://github.com/containerd/nerdctl/issues/1127) |
| Description: "stty with -it", | ||
| Cleanup: func(data test.Data, helpers test.Helpers) { | ||
| helpers.Ensure("rm", "-f", data.Identifier()) | ||
| helpers.Anyhow("rm", "-f", data.Identifier()) |
|
|
||
| func TestRunDeviceCDI(t *testing.T) { | ||
| t.Parallel() | ||
| // Although CDI injection is supported by Docker, specifying the --cdi-spec-dirs on the command line is not. |
|
|
||
| func TestRunDeviceCDIWithNerdctlConfig(t *testing.T) { | ||
| t.Parallel() | ||
| // Although CDI injection is supported by Docker, specifying the --cdi-spec-dirs on the command line is not. |
| // TestRunGPU tests GPU injection using the --gpus flag. | ||
| func TestRunGPU(t *testing.T) { | ||
| t.Parallel() | ||
| // Although CDI injection is supported by Docker, specifying the --cdi-spec-dirs on the command line is not. |
| // TestRunGPUWithOtherCDIDevices tests GPU CDI injection along with other CDI devices. | ||
| func TestRunGPUWithOtherCDIDevices(t *testing.T) { | ||
| t.Parallel() | ||
| // Although CDI injection is supported by Docker, specifying the --cdi-spec-dirs on the command line is not. |
| return subTests | ||
| } | ||
|
|
||
| func assertAddHostEntry(stdout, expected string) error { |
There was a problem hiding this comment.
Needs a comment to explain what it does
| return nil | ||
| } | ||
|
|
||
| func assertAddHostEntries(stdout string, expected []string) error { |
There was a problem hiding this comment.
Same. How is this different from assertAddHostEntry?
There was a problem hiding this comment.
there's none, I've deleted assertAddHostEntry in favor of assertAddHostEntries.
There was a problem hiding this comment.
I also added comments to assertAddHostEntries
bca2734 to
d635153
Compare
|
|
||
| func TestRunDeviceCDI(t *testing.T) { | ||
| t.Parallel() | ||
| // Although CDI injection is supported by Docker, specifying the --cdi-spec-dirs on the command line is not. |
There was a problem hiding this comment.
This should be commented around the line of require.Not(nerdtest.Docker).
Same for other tests too.
There was a problem hiding this comment.
If I understand you correctly, you're asking me to move the // Although CDI injection is supported by Docker... comment to sit above the testCase.Require = require.Not(nerdtest.Docker) line, yes?
cf13079 to
656035d
Compare
Signed-off-by: Daniel Benjamin <benjamindaniel706@gmail.com>
656035d to
d4f4231
Compare
Rewrite tests in container_run_linux_test.go from testutil.NewBase to nerdtest.Setup (Tigron framework). Part of #4613.