containerd / nerdctl

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...
Apache License 2.0
8.24k stars 613 forks source link

testutil helpers are hard to use and make too many assumptions on command outcomes #3130

Closed apostasie closed 2 months ago

apostasie commented 5 months ago

Description

Specifically, some helpers testing stdout do first assert that exit code == 0.

However, there are legitimate cases where exit code is not 0 and you still want to test the output.

Recently, we also faced issues with commands being executed multiple times as each helper invocation used to call Run again.

In light of these issues, maybe it will soon be time to have a look at type Cmd and possibly revamp it to make testing easier.

Steps to reproduce the issue

na

Describe the results you received and expected

na

What version of nerdctl are you using?

main

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

apostasie commented 2 months ago

Besides bugs in our testing tools - hopefully got fixed by now - laying out issues here with the current design, that should inform a proposal to enhance: