nerdctl icon indicating copy to clipboard operation
nerdctl copied to clipboard

test: refactor compose_up_linux_test.go to use Tigron

Open haytok opened this issue 1 month ago • 4 comments

  • related : #4613

haytok avatar Dec 12 '25 20:12 haytok

I simply rewrote the original test as-is, but the error occurred in TestComposeUpNetWithStaticIP, with details as follows.

Details

08:18.6619113Z === [31mFailed[0m
2025-12-12T22:08:18.6619358Z === [31mFAIL[0m: cmd/nerdctl/compose TestComposeUpNetWithStaticIP (0.24s)
2025-12-12T22:08:18.6619495Z     compose_up_linux_test.go:266: 
2025-12-12T22:08:18.6619571Z         
2025-12-12T22:08:18.6619877Z         +============================================================================================================+
2025-12-12T22:08:18.6620432Z         | 🧽      | "TestComposeUpNetWithStaticIP": initial cleanup                                                  |
2025-12-12T22:08:18.6620732Z         +============================================================================================================+
2025-12-12T22:08:18.6620813Z         
2025-12-12T22:08:18.6620941Z     compose_up_linux_test.go:263: 
2025-12-12T22:08:18.6621012Z         
2025-12-12T22:08:18.6621384Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6621861Z         | ➡️      | ⚙️ /usr/bin/docker compose -f  down -v                                                           |
2025-12-12T22:08:18.6622229Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6622703Z         |         | 🚫 command returned a non-zero exit code                                                         |
2025-12-12T22:08:18.6623065Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6623452Z         |         | ⚠️ 1                                                                                             |
2025-12-12T22:08:18.6623817Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6624372Z         |         | 🟠 read /tmp/TestComposeUpNetWithStaticIP1452230407/002: is a directory                          |
2025-12-12T22:08:18.6624800Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6625325Z         | 🌱      | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin                      |
2025-12-12T22:08:18.6625757Z         |         | HOME=/root                                                                                       |
2025-12-12T22:08:18.6626152Z         |         | XDG_CONFIG_HOME=/home/runner/.config                                                             |
2025-12-12T22:08:18.6626533Z         |         | XDG_RUNTIME_DIR=/run/user/1001                                                                   |
2025-12-12T22:08:18.6627070Z         |         | DOCKER_CONFIG=/tmp/TestComposeUpNetWithStaticIP1452230407/003                                    |
2025-12-12T22:08:18.6627433Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6627855Z         | ⏰      | <1s (limit: 3m0s)                                                                                |
2025-12-12T22:08:18.6628216Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6628760Z         | 📁      | /tmp/TestComposeUpNetWithStaticIP1452230407/002                                                  |
2025-12-12T22:08:18.6629180Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6629314Z         
2025-12-12T22:08:18.6629449Z     compose_up_linux_test.go:266: 
2025-12-12T22:08:18.6629522Z         
2025-12-12T22:08:18.6629823Z         +============================================================================================================+
2025-12-12T22:08:18.6630326Z         | 🏗       | "TestComposeUpNetWithStaticIP": setup                                                            |
2025-12-12T22:08:18.6630622Z         +============================================================================================================+
2025-12-12T22:08:18.6630700Z         
2025-12-12T22:08:18.6630894Z     compose_up_linux_test.go:233: projectName="c7434c70"
2025-12-12T22:08:18.6631022Z     compose_up_linux_test.go:241: 
2025-12-12T22:08:18.6631099Z         
2025-12-12T22:08:18.6631460Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6632034Z         | ➡️      | ⚙️ /usr/bin/docker compose -f /tmp/TestComposeUpNetWithStaticIP1452230407/001/c7434c70/compose.y |
2025-12-12T22:08:18.6632347Z         |         | aml up -d                                                                                        |
2025-12-12T22:08:18.6632710Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6633189Z         |         | 🚫 command returned a non-zero exit code                                                         |
2025-12-12T22:08:18.6633550Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6633927Z         |         | ⚠️ 1                                                                                             |
2025-12-12T22:08:18.6634286Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6634797Z         |         | 🟠  Network c7434c70_net0  Creating                                                              |
2025-12-12T22:08:18.6635172Z         |         |  Network c7434c70_net0  Error                                                                    |
2025-12-12T22:08:18.6635733Z         |         | failed to create network c7434c70_net0: Error response from daemon: invalid pool request: Pool o |
2025-12-12T22:08:18.6636212Z         |         | verlaps with other one on this address space                                                     |
2025-12-12T22:08:18.6636578Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6637104Z         | 🌱      | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin                      |
2025-12-12T22:08:18.6637429Z         |         | HOME=/root                                                                                       |
2025-12-12T22:08:18.6637839Z         |         | XDG_CONFIG_HOME=/home/runner/.config                                                             |
2025-12-12T22:08:18.6638210Z         |         | XDG_RUNTIME_DIR=/run/user/1001                                                                   |
2025-12-12T22:08:18.6638737Z         |         | DOCKER_CONFIG=/tmp/TestComposeUpNetWithStaticIP1452230407/003                                    |
2025-12-12T22:08:18.6639101Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6639514Z         | ⏰      | <1s (limit: 3m0s)                                                                                |
2025-12-12T22:08:18.6639875Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6640417Z         | 📁      | /tmp/TestComposeUpNetWithStaticIP1452230407/002                                                  |
2025-12-12T22:08:18.6640891Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6640965Z         
2025-12-12T22:08:18.6641706Z     compose_up_linux_test.go:241: 	🔗 ]8;;file:///home/runner/work/nerdctl/nerdctl/cmd/nerdctl/compose/compose_up_linux_test.go#266:1testCase.Run(t)]8;;[0m
2025-12-12T22:08:18.6641782Z         
2025-12-12T22:08:18.6641900Z         <<<<<<<<<<<<<<<<<<<<
2025-12-12T22:08:18.6642087Z         	🖊️ Command should succeed
2025-12-12T22:08:18.6642378Z         	👀 testing:		`command returned a non-zero exit code`
2025-12-12T22:08:18.6642544Z         	❌ FAILED!		is `<nil>`
2025-12-12T22:08:18.6642655Z         >>>>>>>>>>>>>>>>>>>>
2025-12-12T22:08:18.6642727Z         
2025-12-12T22:08:18.6642861Z     compose_up_linux_test.go:266: 
2025-12-12T22:08:18.6642931Z         
2025-12-12T22:08:18.6643232Z         +============================================================================================================+
2025-12-12T22:08:18.6643760Z         | 🧽      | "TestComposeUpNetWithStaticIP": post-cleanup                                                     |
2025-12-12T22:08:18.6644056Z         +============================================================================================================+
2025-12-12T22:08:18.6644135Z         
2025-12-12T22:08:18.6644261Z     compose_up_linux_test.go:263: 
2025-12-12T22:08:18.6644332Z         
2025-12-12T22:08:18.6644703Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6645266Z         | ➡️      | ⚙️ /usr/bin/docker compose -f /tmp/TestComposeUpNetWithStaticIP1452230407/001/c7434c70/compose.y |
2025-12-12T22:08:18.6645691Z         |         | aml down -v                                                                                      |
2025-12-12T22:08:18.6646052Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6646586Z         | 🌱      | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin                      |
2025-12-12T22:08:18.6646917Z         |         | HOME=/root                                                                                       |
2025-12-12T22:08:18.6647308Z         |         | XDG_CONFIG_HOME=/home/runner/.config                                                             |
2025-12-12T22:08:18.6647751Z         |         | XDG_RUNTIME_DIR=/run/user/1001                                                                   |
2025-12-12T22:08:18.6648227Z         |         | DOCKER_CONFIG=/tmp/TestComposeUpNetWithStaticIP1452230407/003                                    |
2025-12-12T22:08:18.6648595Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6649006Z         | ⏰      | <1s (limit: 3m0s)                                                                                |
2025-12-12T22:08:18.6649378Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6656791Z         | 📁      | /tmp/TestComposeUpNetWithStaticIP1452230407/002                                                  |
2025-12-12T22:08:18.6657209Z         +------------------------------------------------------------------------------------------------------------+
2025-12-12T22:08:18.6657305Z         
2025-12-12T22:08:18.6657312Z 
2025-12-12T22:08:18.6657459Z DONE 840 tests, 340 skipped, 1 failure in 211.641s
2025-12-12T22:08:19.1702202Z ##[error]Process completed with exit code 1.

The crucial point is that the network creation has failed.

🟠  Network c7434c70_net0  Creating
Network c7434c70_net0  Error
failed to create network c7434c70_net0: Error response from daemon: invalid pool request: Pool overlaps with other one on this address space                                                     

It may appear flaky, but we might need to change it to dynamically obtain the subnet.

haytok avatar Dec 13 '25 07:12 haytok

I've retried several times, but the test fails at TestComposeUpNetWithStaticIP. It's strange that the error occurring on CI doesn't happen locally, but I'll investigate the root cause.

haytok avatar Dec 13 '25 10:12 haytok

The subnet used in this test (TestComposeUpNetWithStaticIP) is 172.20.0.0/24.

Reviewing the CI logs where TestComposeUpNetWithStaticIP failed due to the aforementioned error, the 172.20.0.0/24 subnet could potentially be used in two locations.

  • https://productionresultssa13.blob.core.windows.net/actions-results/f138dc83-6e3e-4dac-9849-a300ba1ba00f/workflow-job-run-f1d26e94-912b-5af4-9212-e3c8043c29c1/logs/job/job-logs.txt?rsct=text%2Fplain&se=2025-12-14T17%3A21%3A26Z&sig=39MEDQmPlyPU1L14TqZFmYgoxQQEWKpdB%2BeKqWRtB8w%3D&ske=2025-12-15T02%3A42%3A42Z&skoid=ca7593d4-ee42-46cd-af88-8b886a2f84eb&sks=b&skt=2025-12-14T14%3A42%3A42Z&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skv=2025-11-05&sp=r&spr=https&sr=b&st=2025-12-14T17%3A11%3A21Z&sv=2025-11-05

One is as follows:

https://github.com/containerd/nerdctl/blob/main/cmd/nerdctl/network/network_inspect_test.go#L333-L337

Details

    network_inspect_test.go:402: 
2025-12-13T10:48:03.4825715Z         
2025-12-13T10:48:03.4826171Z         +------------------------------------------------------------------------------------------------------------+
2025-12-13T10:48:03.4827036Z         | ➡️      | ⚙️ /usr/bin/docker network inspect testnetworkinspect-display-containers-belonging-to-multiple-n |
2025-12-13T10:48:03.4827776Z         |         | etwork-f3bc8cbe                                                                                  |
2025-12-13T10:48:03.4828389Z         +------------------------------------------------------------------------------------------------------------+
2025-12-13T10:48:03.4829029Z         |         | 🟢 [                                                                                             |
2025-12-13T10:48:03.4829589Z         |         |     {                                                                                            |
2025-12-13T10:48:03.4830311Z         |         |         "Name": "testnetworkinspect-display-containers-belonging-to-multiple-network-f3bc8cbe",  |
2025-12-13T10:48:03.4831116Z         |         |         "Id": "3704f460860e710a2ed86f24d02c5fcdac346040247ce52a8fd50c1cccd05f5f",                |
2025-12-13T10:48:03.4831924Z         |         |         "Created": "2025-12-13T10:48:01.918667019Z",                                             |
2025-12-13T10:48:03.4832529Z         |         |         "Scope": "local",                                                                        |
2025-12-13T10:48:03.4833211Z         |         |         "Driver": "bridge",                                                                      |
2025-12-13T10:48:03.4833779Z         |         |         "EnableIPv4": true,                                                                      |
2025-12-13T10:48:03.4834363Z         |         |         "EnableIPv6": false,                                                                     |
2025-12-13T10:48:03.4834910Z         |         |         "IPAM": {                                                                                |
2025-12-13T10:48:03.4835454Z         |         |             "Driver": "default",                                                                 |
2025-12-13T10:48:03.4835997Z         |         |             "Options": {},                                                                       |
2025-12-13T10:48:03.4836525Z         |         |             "Config": [                                                                          |
2025-12-13T10:48:03.4837034Z         |         |                 {                                                                                |
2025-12-13T10:48:03.4837559Z         |         |                     "Subnet": "172.20.0.0/16",                                                   |
2025-12-13T10:48:03.4838119Z         |         |                     "Gateway": "172.20.0.1"                                                      |
2025-12-13T10:48:03.4838640Z         |         |                 }                                                                                |
2025-12-13T10:48:03.4839122Z         |         |             ]                                                                                    |
2025-12-13T10:48:03.4839602Z         |         |         },                                                                                       |
2025-12-13T10:48:03.4840124Z         |         |         "Internal": false,                                                                       |
2025-12-13T10:48:03.4840768Z         |         |         "Attachable": false,                                                                     |
2025-12-13T10:48:03.4841342Z         |         |         "Ingress": false,                                                                        |
2025-12-13T10:48:03.4842346Z         |         |         "ConfigFrom": {                                                                          |
2025-12-13T10:48:03.4843099Z         |         |             "Network": ""                                                                        |
2025-12-13T10:48:03.4843999Z         |         |         },                                                                                       |
2025-12-13T10:48:03.4844682Z         |         |         "ConfigOnly": false,                                                                     |
2025-12-13T10:48:03.4845425Z         |         |         "Containers": {                                                                          |
2025-12-13T10:48:03.4846422Z         |         |             "b259ec587c3c3ebb28b57a5a22e92744aff04129f6b76d0ecb72f3a52da36482": {                |
2025-12-13T10:48:03.4847351Z         |         |                 "Name": "testnetworkinspect-display-containers-belonging-to-multiple-network-abb |
2025-12-13T10:48:03.4848276Z         |         | f04bd",                                                                                          |
2025-12-13T10:48:03.4849030Z         |         |                 "EndpointID": "8a96a2ef5419572c392e7c72effa7cd5251c4b80b9bc3cd74b1ce33c7cb9e51e" |
2025-12-13T10:48:03.4849757Z         |         | ,                                                                                                |
2025-12-13T10:48:03.4850432Z         |         |                 "MacAddress": "aa:5d:85:de:0c:de",                                               |
2025-12-13T10:48:03.4851233Z         |         |                 "IPv4Address": "172.20.0.2/16",                                                  |
2025-12-13T10:48:03.4852174Z         |         |                 "IPv6Address": ""                                                                |
2025-12-13T10:48:03.4852837Z         |         |             }                                                                                    |
2025-12-13T10:48:03.4853336Z         |         |         },                                                                                       |
2025-12-13T10:48:03.4853964Z         |         |         "Options": {},                                                                           |
2025-12-13T10:48:03.4854765Z         |         |         "Labels": {}                                                                             |
2025-12-13T10:48:03.4855424Z         |         |     }                                                                                            |
2025-12-13T10:48:03.4856000Z         |         | ]                                                                                                |
2025-12-13T10:48:03.4856585Z         +------------------------------------------------------------------------------------------------------------+
2025-12-13T10:48:03.4857669Z         | 🌱      | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin                      |
2025-12-13T10:48:03.4858343Z         |         | HOME=/root                                                                                       |
2025-12-13T10:48:03.4858963Z         |         | XDG_CONFIG_HOME=/home/runner/.config                                                             |
2025-12-13T10:48:03.4859624Z         |         | XDG_RUNTIME_DIR=/run/user/1001                                                                   |
2025-12-13T10:48:03.4860374Z         |         | DOCKER_CONFIG=/tmp/TestNetworkInspectDisplay_containers_belonging_to_multiple_netw1439837965/003 |
2025-12-13T10:48:03.4861116Z         +------------------------------------------------------------------------------------------------------------+
2025-12-13T10:48:03.4862170Z         | ⏰      | <1s (limit: 3m0s)                                                                                |
2025-12-13T10:48:03.4862777Z         +------------------------------------------------------------------------------------------------------------+
2025-12-13T10:48:03.4863726Z         | 📁      | /tmp/TestNetworkInspectDisplay_containers_belonging_to_multiple_netw1439837965/002               |
2025-12-13T10:48:03.4864461Z         +------------------------------------------------------------------------------------------------------------+

The other is as follows:

https://github.com/containerd/nerdctl/blob/main/cmd/nerdctl/network/network_inspect_test.go#L119-L127

Details

2025-12-13T10:48:03.5823620Z     network_inspect_test.go:402: 
2025-12-13T10:48:03.5823861Z         
2025-12-13T10:48:03.5824500Z         +------------------------------------------------------------------------------------------------------------+
2025-12-13T10:48:03.5825848Z         | ➡️      | ⚙️ /usr/bin/docker network inspect custom                                                        |
2025-12-13T10:48:03.5826655Z         +------------------------------------------------------------------------------------------------------------+
2025-12-13T10:48:03.5827529Z         |         | 🟢 [                                                                                             |
2025-12-13T10:48:03.5828217Z         |         |     {                                                                                            |
2025-12-13T10:48:03.5828859Z         |         |         "Name": "custom",                                                                        |
2025-12-13T10:48:03.5829619Z         |         |         "Id": "69794eec965cb062099a667601d0584be27b047235d9699699248227a0ffef9a",                |
2025-12-13T10:48:03.5830415Z         |         |         "Created": "2025-12-13T10:48:03.105533339Z",                                             |
2025-12-13T10:48:03.5831102Z         |         |         "Scope": "local",                                                                        |
2025-12-13T10:48:03.5832273Z         |         |         "Driver": "bridge",                                                                      |
2025-12-13T10:48:03.5833375Z         |         |         "EnableIPv4": true,                                                                      |
2025-12-13T10:48:03.5834501Z         |         |         "EnableIPv6": false,                                                                     |
2025-12-13T10:48:03.5835533Z         |         |         "IPAM": {                                                                                |
2025-12-13T10:48:03.5836274Z         |         |             "Driver": "default",                                                                 |
2025-12-13T10:48:03.5836845Z         |         |             "Options": {},                                                                       |
2025-12-13T10:48:03.5837377Z         |         |             "Config": [                                                                          |
2025-12-13T10:48:03.5837881Z         |         |                 {                                                                                |
2025-12-13T10:48:03.5838518Z         |         |                     "Subnet": "172.20.0.0/16",                                                   |
2025-12-13T10:48:03.5839096Z         |         |                     "Gateway": "172.20.0.1"                                                      |
2025-12-13T10:48:03.5839623Z         |         |                 }                                                                                |
2025-12-13T10:48:03.5840115Z         |         |             ]                                                                                    |
2025-12-13T10:48:03.5840599Z         |         |         },                                                                                       |
2025-12-13T10:48:03.5841133Z         |         |         "Internal": false,                                                                       |
2025-12-13T10:48:03.5842019Z         |         |         "Attachable": false,                                                                     |
2025-12-13T10:48:03.5843074Z         |         |         "Ingress": false,                                                                        |
2025-12-13T10:48:03.5844093Z         |         |         "ConfigFrom": {                                                                          |
2025-12-13T10:48:03.5845068Z         |         |             "Network": ""                                                                        |
2025-12-13T10:48:03.5846084Z         |         |         },                                                                                       |
2025-12-13T10:48:03.5847061Z         |         |         "ConfigOnly": false,                                                                     |
2025-12-13T10:48:03.5848139Z         |         |         "Containers": {},                                                                        |
2025-12-13T10:48:03.5849171Z         |         |         "Options": {},                                                                           |
2025-12-13T10:48:03.5850378Z         |         |         "Labels": {}                                                                             |
2025-12-13T10:48:03.5851331Z         |         |     }                                                                                            |
2025-12-13T10:48:03.5852457Z         |         | ]                                                                                                |
2025-12-13T10:48:03.5853144Z         +------------------------------------------------------------------------------------------------------------+
2025-12-13T10:48:03.5853994Z         | 🌱      | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin                      |
2025-12-13T10:48:03.5854667Z         |         | HOME=/root                                                                                       |
2025-12-13T10:48:03.5855552Z         |         | XDG_CONFIG_HOME=/home/runner/.config                                                             |
2025-12-13T10:48:03.5856830Z         |         | XDG_RUNTIME_DIR=/run/user/1001                                                                   |
2025-12-13T10:48:03.5858209Z         |         | DOCKER_CONFIG=/tmp/TestNetworkInspectcustom708212983/003                                         |
2025-12-13T10:48:03.5859540Z         +------------------------------------------------------------------------------------------------------------+
2025-12-13T10:48:03.5860841Z         | ⏰      | <1s (limit: 3m0s)                                                                                |
2025-12-13T10:48:03.5862160Z         +------------------------------------------------------------------------------------------------------------+
2025-12-13T10:48:03.5863659Z         | 📁      | /tmp/TestNetworkInspectcustom708212983/002                                                       |
2025-12-13T10:48:03.5865108Z         +------------------------------------------------------------------------------------------------------------+

These two tests use Docker, but it is thought that the subnet created on the Docker side overlapped with the one on the nerdctl side.

Therefore, we will verify operation by ensuring the subnet range does not overlap with the network created by docker network create.

haytok avatar Dec 14 '25 18:12 haytok

All the tests I re-wrote this time passed. Therefore, I think they are ready for review.

haytok avatar Dec 14 '25 19:12 haytok