mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
[no-relnote] Add E2E for libnvidia-container
Some checks failed
Some checks failed
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
This commit is contained in:
parent
890db82b46
commit
8c42c1455e
811
ginkgo.json
Normal file
811
ginkgo.json
Normal file
@ -0,0 +1,811 @@
|
||||
[
|
||||
{
|
||||
"SuitePath": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e",
|
||||
"SuiteDescription": "E2E NVIDIA Container Toolkit",
|
||||
"SuiteLabels": [],
|
||||
"SuiteSucceeded": true,
|
||||
"SuiteHasProgrammaticFocus": false,
|
||||
"SpecialSuiteFailureReasons": null,
|
||||
"PreRunStats": {
|
||||
"TotalSpecs": 17,
|
||||
"SpecsThatWillRun": 1
|
||||
},
|
||||
"StartTime": "2025-05-30T17:30:37.919847+02:00",
|
||||
"EndTime": "2025-05-30T17:31:22.573392+02:00",
|
||||
"RunTime": 44653713916,
|
||||
"SuiteConfig": {
|
||||
"RandomSeed": 1748619036,
|
||||
"RandomizeAllSpecs": false,
|
||||
"FocusStrings": [
|
||||
"nvidia-container-cli"
|
||||
],
|
||||
"SkipStrings": null,
|
||||
"FocusFiles": null,
|
||||
"SkipFiles": null,
|
||||
"LabelFilter": "",
|
||||
"FailOnPending": false,
|
||||
"FailOnEmpty": false,
|
||||
"FailFast": false,
|
||||
"FlakeAttempts": 0,
|
||||
"MustPassRepeatedly": 0,
|
||||
"DryRun": false,
|
||||
"PollProgressAfter": 0,
|
||||
"PollProgressInterval": 0,
|
||||
"Timeout": 3598886492000,
|
||||
"EmitSpecProgress": false,
|
||||
"OutputInterceptorMode": "",
|
||||
"SourceRoots": null,
|
||||
"GracePeriod": 30000000000,
|
||||
"ParallelProcess": 1,
|
||||
"ParallelTotal": 1,
|
||||
"ParallelHost": ""
|
||||
},
|
||||
"SpecReports": [
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"nvidia-container-cli",
|
||||
"when running nvidia-smi -L"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 104
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 129
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 146
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support NVIDIA_VISIBLE_DEVICES and NVIDIA_DRIVER_CAPABILITIES",
|
||||
"State": "passed",
|
||||
"StartTime": "2025-05-30T17:30:37.91994+02:00",
|
||||
"EndTime": "2025-05-30T17:31:22.572335+02:00",
|
||||
"RunTime": 44652563291,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 1,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0,
|
||||
"SpecEvents": [
|
||||
{
|
||||
"SpecEventType": "Node",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 108
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 1,
|
||||
"Time": "2025-05-30T17:30:37.919945+02:00"
|
||||
},
|
||||
"Message": "nvidia-container-cli",
|
||||
"NodeType": "BeforeAll"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "Node (End)",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 108
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 3,
|
||||
"Time": "2025-05-30T17:30:37.920072+02:00"
|
||||
},
|
||||
"Message": "nvidia-container-cli",
|
||||
"Duration": 127500,
|
||||
"NodeType": "BeforeAll"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "Node",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 133
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 4,
|
||||
"Time": "2025-05-30T17:30:37.920073+02:00"
|
||||
},
|
||||
"Message": "when running nvidia-smi -L",
|
||||
"NodeType": "BeforeAll"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "Node (End)",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 133
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 6,
|
||||
"Time": "2025-05-30T17:30:44.382334+02:00"
|
||||
},
|
||||
"Message": "when running nvidia-smi -L",
|
||||
"Duration": 6462285125,
|
||||
"NodeType": "BeforeAll"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "Node",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 146
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 7,
|
||||
"Time": "2025-05-30T17:30:44.382669+02:00"
|
||||
},
|
||||
"Message": "should support NVIDIA_VISIBLE_DEVICES and NVIDIA_DRIVER_CAPABILITIES",
|
||||
"NodeType": "It"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "By",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 147
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 8,
|
||||
"Time": "2025-05-30T17:30:44.382829+02:00"
|
||||
},
|
||||
"Message": "creating the test script on the remote host"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "By",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 154
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 9,
|
||||
"Time": "2025-05-30T17:30:46.268934+02:00"
|
||||
},
|
||||
"Message": "discovering the symlink targets for the libraries on the remote host"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "By",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 168
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 10,
|
||||
"Time": "2025-05-30T17:30:50.005511+02:00"
|
||||
},
|
||||
"Message": "rendering the docker run template with the discovered targets"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "By",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 179
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 11,
|
||||
"Time": "2025-05-30T17:30:50.005651+02:00"
|
||||
},
|
||||
"Message": "starting the container using the rendered docker run command"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "By",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 183
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 12,
|
||||
"Time": "2025-05-30T17:30:57.455115+02:00"
|
||||
},
|
||||
"Message": "checking the container logs for the expected output"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "Node (End)",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 146
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 14,
|
||||
"Time": "2025-05-30T17:31:20.561359+02:00"
|
||||
},
|
||||
"Message": "should support NVIDIA_VISIBLE_DEVICES and NVIDIA_DRIVER_CAPABILITIES",
|
||||
"Duration": 36178826958,
|
||||
"NodeType": "It"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "Node",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 141
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 15,
|
||||
"Time": "2025-05-30T17:31:20.561375+02:00"
|
||||
},
|
||||
"Message": "when running nvidia-smi -L",
|
||||
"NodeType": "AfterAll"
|
||||
},
|
||||
{
|
||||
"SpecEventType": "Node (End)",
|
||||
"CodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-cli_test.go",
|
||||
"LineNumber": 141
|
||||
},
|
||||
"TimelineLocation": {
|
||||
"Order": 17,
|
||||
"Time": "2025-05-30T17:31:22.57233+02:00"
|
||||
},
|
||||
"Message": "when running nvidia-smi -L",
|
||||
"Duration": 2010962791,
|
||||
"NodeType": "AfterAll"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when running nvidia-smi -L"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 58
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 70
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support NVIDIA_VISIBLE_DEVICES",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.572477+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when running nvidia-smi -L"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 58
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 76
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support automatic CDI spec generation",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.572728+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when running nvidia-smi -L"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 58
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 82
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support automatic CDI spec generation with the --gpus flag",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.572841+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when running nvidia-smi -L"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 58
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 88
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support the --gpus flag using the nvidia-container-runtime",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.572851+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when running nvidia-smi -L"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 58
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 94
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support the --gpus flag using the nvidia-container-runtime-hook",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.572866+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Running the cuda-vectorAdd sample"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 103
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 111
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support NVIDIA_VISIBLE_DEVICES",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.572875+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Running the cuda-vectorAdd sample"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 103
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 119
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support automatic CDI spec generation",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.572884+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Running the cuda-vectorAdd sample"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 103
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 125
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support the --gpus flag using the nvidia-container-runtime",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.572893+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Running the cuda-vectorAdd sample"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 103
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 131
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support the --gpus flag using the nvidia-container-runtime-hook",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.572985+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Running the cuda-deviceQuery sample"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 140
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 148
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support NVIDIA_VISIBLE_DEVICES",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.573025+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Running the cuda-deviceQuery sample"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 140
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 155
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support automatic CDI spec generation",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.573034+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Running the cuda-deviceQuery sample"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 140
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 161
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support the --gpus flag using the nvidia-container-runtime",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.573046+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Running the cuda-deviceQuery sample"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 140
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 167
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should support the --gpus flag using the nvidia-container-runtime-hook",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.573322+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Testing CUDA Forward compatibility"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 174
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 201
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should work with the nvidia runtime in legacy mode",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.573332+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Testing CUDA Forward compatibility"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 174
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 207
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should work with the nvidia runtime in CDI mode",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.573337+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
},
|
||||
{
|
||||
"ContainerHierarchyTexts": [
|
||||
"docker",
|
||||
"when Testing CUDA Forward compatibility"
|
||||
],
|
||||
"ContainerHierarchyLocations": [
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 29
|
||||
},
|
||||
{
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 174
|
||||
}
|
||||
],
|
||||
"ContainerHierarchyLabels": [
|
||||
[],
|
||||
[]
|
||||
],
|
||||
"LeafNodeType": "It",
|
||||
"LeafNodeLocation": {
|
||||
"FileName": "/Users/eduardoa/src/github/nvidia/nvidia-container-toolkit/tests/e2e/nvidia-container-toolkit_test.go",
|
||||
"LineNumber": 213
|
||||
},
|
||||
"LeafNodeLabels": [],
|
||||
"LeafNodeText": "should NOT work with nvidia-container-runtime-hook",
|
||||
"State": "skipped",
|
||||
"StartTime": "2025-05-30T17:31:22.573361+02:00",
|
||||
"EndTime": "0001-01-01T00:00:00Z",
|
||||
"RunTime": 0,
|
||||
"ParallelProcess": 1,
|
||||
"NumAttempts": 0,
|
||||
"MaxFlakeAttempts": 0,
|
||||
"MaxMustPassRepeatedly": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -20,8 +20,14 @@ LOG_ARTIFACTS_DIR ?= $(CURDIR)/e2e_logs
|
||||
|
||||
GINKGO_BIN := $(CURDIR)/bin/ginkgo
|
||||
|
||||
# If GINKGO_FOCUS is not set, run all tests
|
||||
# current available tests:
|
||||
# - nvidia-container-cli
|
||||
# - docker
|
||||
GINKGO_FOCUS ?=
|
||||
|
||||
test: $(GINKGO_BIN)
|
||||
$(GINKGO_BIN) $(GINKGO_ARGS) -v --json-report ginkgo.json ./tests/e2e/...
|
||||
$(GINKGO_BIN) $(GINKGO_ARGS) -v --json-report ginkgo.json --focus="$(GINKGO_FOCUS)" ./tests/e2e/...
|
||||
|
||||
$(GINKGO_BIN):
|
||||
mkdir -p $(CURDIR)/bin
|
||||
|
||||
@ -28,11 +28,20 @@ var dockerInstallTemplate = `
|
||||
#! /usr/bin/env bash
|
||||
set -xe
|
||||
|
||||
: ${IMAGE:={{.Image}}}
|
||||
# if the TEMP_DIR is already set, use it
|
||||
if [ -f /tmp/ctk_e2e_temp_dir.txt ]; then
|
||||
TEMP_DIR=$(cat /tmp/ctk_e2e_temp_dir.txt)
|
||||
else
|
||||
TEMP_DIR="/tmp/ctk_e2e.$(date +%s)_$RANDOM"
|
||||
echo "$TEMP_DIR" > /tmp/ctk_e2e_temp_dir.txt
|
||||
fi
|
||||
|
||||
# Create a temporary directory
|
||||
TEMP_DIR="/tmp/ctk_e2e.$(date +%s)_$RANDOM"
|
||||
mkdir -p "$TEMP_DIR"
|
||||
# if TEMP_DIR does not exist, create it
|
||||
if [ ! -d "$TEMP_DIR" ]; then
|
||||
mkdir -p "$TEMP_DIR"
|
||||
fi
|
||||
|
||||
: ${IMAGE:={{.Image}}}
|
||||
|
||||
# Given that docker has an init function that checks for the existence of the
|
||||
# nvidia-container-toolkit, we need to create a symlink to the nvidia-container-runtime-hook
|
||||
|
||||
275
tests/e2e/nvidia-container-cli_test.go
Normal file
275
tests/e2e/nvidia-container-cli_test.go
Normal file
@ -0,0 +1,275 @@
|
||||
/*
|
||||
* Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
const (
|
||||
libnvidiaContainerCliDockerRunTemplate = `
|
||||
docker run -d --name test-nvidia-container-cli \
|
||||
--privileged \
|
||||
--runtime=nvidia \
|
||||
-e NVIDIA_VISIBLE_DEVICES=all \
|
||||
-e NVIDIA_DRIVER_CAPABILITIES=all \
|
||||
-v $HOME/libnvidia-container-cli.sh:/usr/local/bin/libnvidia-container-cli.sh \
|
||||
-v {{.NvidiaContainerCliSrc}}:/usr/bin/nvidia-container-cli \
|
||||
-v {{.NvidiaContainerCliRealSrc}}:{{.NvidiaContainerCliRealTarget}} \
|
||||
-v {{.NvidiaCtkSrc}}:/usr/bin/nvidia-ctk \
|
||||
-v {{.NvidiaCtkRealSrc}}:{{.NvidiaCtkRealTarget}} \
|
||||
-v {{.NvidiaContainerRuntimeSrc}}:/usr/bin/nvidia-container-runtime \
|
||||
-v {{.NvidiaContainerRuntimeRealSrc}}:{{.NvidiaContainerRuntimeRealTarget}} \
|
||||
-v {{.NvidiaContainerRuntimeHookSrc}}:/usr/bin/nvidia-container-runtime-hook \
|
||||
-v {{.NvidiaContainerRuntimeHookRealSrc}}:{{.NvidiaContainerRuntimeHookRealTarget}} \
|
||||
-v {{.NvidiaContainerToolkitSrc}}:/usr/bin/nvidia-container-toolkit \
|
||||
-v {{.NvidiaCdiHookSrc}}:/usr/bin/nvidia-cdi-hook \
|
||||
-v {{.NvidiaCdiHookRealSrc}}:{{.NvidiaCdiHookRealTarget}} \
|
||||
-v {{.NvidiaContainerRuntimeCdiSrc}}:/usr/bin/nvidia-container-runtime.cdi \
|
||||
-v {{.NvidiaContainerRuntimeCdiRealSrc}}:{{.NvidiaContainerRuntimeCdiRealTarget}} \
|
||||
-v {{.NvidiaContainerRuntimeLegacySrc}}:/usr/bin/nvidia-container-runtime.legacy \
|
||||
-v {{.NvidiaContainerRuntimeLegacyRealSrc}}:{{.NvidiaContainerRuntimeLegacyRealTarget}} \
|
||||
-v {{.ToolkitDir}}/toolkit:/usr/local/nvidia/toolkit \
|
||||
-v /etc/nvidia-container-runtime:/etc/nvidia-container-runtime \
|
||||
-v {{.LibNvidiaContainerSo1Src}}:/usr/lib/x86_64-linux-gnu/libnvidia-container.so.1 \
|
||||
-v {{.LibNvidiaContainerTargetSrc}}:/usr/lib/x86_64-linux-gnu/{{.LibNvidiaContainerTarget}} \
|
||||
-v {{.LibNvidiaContainerGoSo1Src}}:/usr/lib/x86_64-linux-gnu/libnvidia-container-go.so.1 \
|
||||
-v {{.LibNvidiaContainerGoTargetSrc}}:/usr/lib/x86_64-linux-gnu/{{.LibNvidiaContainerGoTarget}} \
|
||||
-e LD_LIBRARY_PATH=/usr/lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/aarch64-linux-gnu:/lib64:/lib/x86_64-linux-gnu:/lib/aarch64-linux-gnu \
|
||||
--entrypoint /usr/local/bin/libnvidia-container-cli.sh \
|
||||
ubuntu
|
||||
`
|
||||
|
||||
libnvidiaContainerCliTestTemplate = `#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
apt-get update -y && apt-get install -y curl gnupg2
|
||||
|
||||
WORKDIR="$(mktemp -d)"
|
||||
ROOTFS="${WORKDIR}/rootfs"
|
||||
mkdir -p "${ROOTFS}"
|
||||
|
||||
export WORKDIR ROOTFS # make them visible in the child shell
|
||||
|
||||
unshare --mount --pid --fork --propagation private -- bash -eux <<'IN_NS'
|
||||
: "${ROOTFS:?}" "${WORKDIR:?}" # abort if either is empty
|
||||
|
||||
# 1 Populate minimal Ubuntu base
|
||||
curl -L http://cdimage.ubuntu.com/ubuntu-base/releases/22.04/release/ubuntu-base-22.04-base-amd64.tar.gz \
|
||||
| tar -C "$ROOTFS" -xz
|
||||
|
||||
# 2 Add non-root user
|
||||
useradd -R "$ROOTFS" -U -u 1000 -s /bin/bash nvidia
|
||||
|
||||
# 3 Bind-mount new root and unshare mounts
|
||||
mount --bind "$ROOTFS" "$ROOTFS"
|
||||
mount --make-private "$ROOTFS"
|
||||
cd "$ROOTFS"
|
||||
|
||||
# 4 Minimal virtual filesystems
|
||||
mount -t proc proc proc
|
||||
mount -t sysfs sys sys
|
||||
mount -t tmpfs tmp tmp
|
||||
mount -t tmpfs run run
|
||||
|
||||
# 5 GPU setup
|
||||
nvidia-container-cli --load-kmods --debug=container-cli.log \
|
||||
configure --ldconfig=@/sbin/ldconfig.real \
|
||||
--no-cgroups --utility --device=0 "$(pwd)"
|
||||
|
||||
# 6 Switch root
|
||||
mkdir -p mnt
|
||||
pivot_root . mnt
|
||||
umount -l /mnt
|
||||
|
||||
exec nvidia-smi -L
|
||||
IN_NS
|
||||
`
|
||||
)
|
||||
|
||||
// getToolkitDir tries to read the toolkit dir from /tmp/ctk_e2e_temp_dir.txt using the runner. Returns empty string if not found.
|
||||
func getToolkitDir(runner Runner) string {
|
||||
out, _, err := runner.Run("cat /tmp/ctk_e2e_temp_dir.txt")
|
||||
if err == nil {
|
||||
dir := strings.TrimSpace(out)
|
||||
if dir != "" {
|
||||
return dir
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// getToolkitLayout returns the toolkit dir, a flag for flat layout, and a function to get the source path for a given filename.
|
||||
func getToolkitLayout(runner Runner) (toolkitDir string, useFlatLayout bool, srcPath func(string) string) {
|
||||
tempDir := getToolkitDir(runner)
|
||||
if tempDir == "" {
|
||||
return "", false, func(filename string) string {
|
||||
if strings.HasPrefix(filename, "lib") {
|
||||
return "/usr/lib/x86_64-linux-gnu/" + filename
|
||||
}
|
||||
return "/usr/bin/" + filename
|
||||
}
|
||||
}
|
||||
return tempDir, true, func(filename string) string {
|
||||
return tempDir + "/toolkit/" + filename
|
||||
}
|
||||
}
|
||||
|
||||
// getRealTargetPath returns the correct target path for a .real binary depending on the install type.
|
||||
func getRealTargetPath(filename, toolkitDir string) string {
|
||||
if toolkitDir == "" {
|
||||
return "/usr/bin/" + filename
|
||||
}
|
||||
return toolkitDir + "/toolkit/" + filename
|
||||
}
|
||||
|
||||
// Integration tests for Docker runtime
|
||||
var _ = Describe("nvidia-container-cli", Ordered, ContinueOnFailure, func() {
|
||||
var runner Runner
|
||||
|
||||
// Install the NVIDIA Container Toolkit
|
||||
BeforeAll(func(ctx context.Context) {
|
||||
runner = NewRunner(
|
||||
WithHost(sshHost),
|
||||
WithPort(sshPort),
|
||||
WithSshKey(sshKey),
|
||||
WithSshUser(sshUser),
|
||||
)
|
||||
|
||||
if installCTK {
|
||||
installer, err := NewToolkitInstaller(
|
||||
WithRunner(runner),
|
||||
WithImage(imageName+":"+imageTag),
|
||||
WithTemplate(dockerInstallTemplate),
|
||||
)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = installer.Install()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
})
|
||||
|
||||
When("running nvidia-smi -L", Ordered, func() {
|
||||
var hostOutput string
|
||||
var err error
|
||||
|
||||
BeforeAll(func(ctx context.Context) {
|
||||
hostOutput, _, err = runner.Run("nvidia-smi -L")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, _, err := runner.Run("docker pull ubuntu")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterAll(func(ctx context.Context) {
|
||||
_, _, err := runner.Run("docker rm -f test-nvidia-container-cli")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("should support NVIDIA_VISIBLE_DEVICES and NVIDIA_DRIVER_CAPABILITIES", func(ctx context.Context) {
|
||||
// 1. Create the test script on the remote host at $HOME/test.sh using a here-document
|
||||
testScriptPath := "$HOME/libnvidia-container-cli.sh"
|
||||
testScript := libnvidiaContainerCliTestTemplate
|
||||
createScriptCmd := fmt.Sprintf("cat > %s <<'EOF'\n%s\nEOF\nchmod +x %s", testScriptPath, testScript, testScriptPath)
|
||||
_, _, err := runner.Run(createScriptCmd)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// 2. Discover the symlink targets for the libraries on the remote host
|
||||
getTargetCmd := func(lib string) string {
|
||||
return fmt.Sprintf("readlink -f /usr/lib/x86_64-linux-gnu/%s.1", lib)
|
||||
}
|
||||
libNvidiaContainerTarget, _, err := runner.Run(getTargetCmd("libnvidia-container.so"))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
libNvidiaContainerTarget = strings.TrimSpace(libNvidiaContainerTarget)
|
||||
libNvidiaContainerTarget = strings.TrimPrefix(libNvidiaContainerTarget, "/usr/lib/x86_64-linux-gnu/")
|
||||
|
||||
libNvidiaContainerGoTarget, _, err := runner.Run(getTargetCmd("libnvidia-container-go.so"))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
libNvidiaContainerGoTarget = strings.TrimSpace(libNvidiaContainerGoTarget)
|
||||
libNvidiaContainerGoTarget = strings.TrimPrefix(libNvidiaContainerGoTarget, "/usr/lib/x86_64-linux-gnu/")
|
||||
|
||||
// 3. Get toolkit layout info and source path helper
|
||||
toolkitDir, _, srcPath := getToolkitLayout(runner)
|
||||
|
||||
// 4. Render the docker run template with the discovered targets and computed source paths
|
||||
tmpl, err := template.New("dockerRun").Parse(libnvidiaContainerCliDockerRunTemplate)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
var dockerRunCmdBuilder strings.Builder
|
||||
err = tmpl.Execute(&dockerRunCmdBuilder, map[string]string{
|
||||
"ToolkitDir": toolkitDir,
|
||||
"NvidiaContainerCliSrc": srcPath("nvidia-container-cli"),
|
||||
"NvidiaContainerCliRealSrc": srcPath("nvidia-container-cli.real"),
|
||||
"NvidiaContainerCliRealTarget": getRealTargetPath("nvidia-container-cli.real", toolkitDir),
|
||||
"NvidiaCtkSrc": srcPath("nvidia-ctk"),
|
||||
"NvidiaCtkRealSrc": srcPath("nvidia-ctk.real"),
|
||||
"NvidiaCtkRealTarget": getRealTargetPath("nvidia-ctk.real", toolkitDir),
|
||||
"NvidiaContainerRuntimeSrc": srcPath("nvidia-container-runtime"),
|
||||
"NvidiaContainerRuntimeRealSrc": srcPath("nvidia-container-runtime.real"),
|
||||
"NvidiaContainerRuntimeRealTarget": getRealTargetPath("nvidia-container-runtime.real", toolkitDir),
|
||||
"NvidiaContainerRuntimeHookSrc": srcPath("nvidia-container-runtime-hook"),
|
||||
"NvidiaContainerRuntimeHookRealSrc": srcPath("nvidia-container-runtime-hook.real"),
|
||||
"NvidiaContainerRuntimeHookRealTarget": getRealTargetPath("nvidia-container-runtime-hook.real", toolkitDir),
|
||||
"NvidiaContainerToolkitSrc": srcPath("nvidia-container-toolkit"),
|
||||
"NvidiaCdiHookSrc": srcPath("nvidia-cdi-hook"),
|
||||
"NvidiaCdiHookRealSrc": srcPath("nvidia-cdi-hook.real"),
|
||||
"NvidiaCdiHookRealTarget": getRealTargetPath("nvidia-cdi-hook.real", toolkitDir),
|
||||
"NvidiaContainerRuntimeCdiSrc": srcPath("nvidia-container-runtime.cdi"),
|
||||
"NvidiaContainerRuntimeCdiRealSrc": srcPath("nvidia-container-runtime.cdi.real"),
|
||||
"NvidiaContainerRuntimeCdiRealTarget": getRealTargetPath("nvidia-container-runtime.cdi.real", toolkitDir),
|
||||
"NvidiaContainerRuntimeLegacySrc": srcPath("nvidia-container-runtime.legacy"),
|
||||
"NvidiaContainerRuntimeLegacyRealSrc": srcPath("nvidia-container-runtime.legacy.real"),
|
||||
"NvidiaContainerRuntimeLegacyRealTarget": getRealTargetPath("nvidia-container-runtime.legacy.real", toolkitDir),
|
||||
"LibNvidiaContainerSo1Src": srcPath("libnvidia-container.so.1"),
|
||||
"LibNvidiaContainerTargetSrc": srcPath(libNvidiaContainerTarget),
|
||||
"LibNvidiaContainerGoSo1Src": srcPath("libnvidia-container-go.so.1"),
|
||||
"LibNvidiaContainerGoTargetSrc": srcPath(libNvidiaContainerGoTarget),
|
||||
"LibNvidiaContainerTarget": libNvidiaContainerTarget,
|
||||
"LibNvidiaContainerGoTarget": libNvidiaContainerGoTarget,
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
dockerRunCmd := dockerRunCmdBuilder.String()
|
||||
|
||||
// 5. Start the container using the rendered docker run command
|
||||
_, _, err = runner.Run(dockerRunCmd)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// 6. Use Eventually to check the container logs contain hostOutput
|
||||
expected := strings.TrimSpace(strings.ReplaceAll(hostOutput, "\r", ""))
|
||||
Eventually(func() string {
|
||||
logs, _, err := runner.Run("docker logs test-nvidia-container-cli | tail -n 20")
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
logLines := strings.Split(strings.TrimSpace(logs), "\n")
|
||||
if len(logLines) == 0 {
|
||||
return ""
|
||||
}
|
||||
lastLine := strings.TrimSpace(strings.ReplaceAll(logLines[len(logLines)-1], "\r", ""))
|
||||
return lastLine
|
||||
}, "5m", "5s").Should(Equal(expected))
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user