Skip to content

Fix nop write closer#34

Closed
coderbirju wants to merge 103 commits into
mainfrom
fix-nopWriteCloser
Closed

Fix nop write closer#34
coderbirju wants to merge 103 commits into
mainfrom
fix-nopWriteCloser

Conversation

@coderbirju

Copy link
Copy Markdown
Owner

No description provided.

ogulcanaydogan and others added 30 commits May 14, 2026 11:05
….Setup

Part of the ongoing Tigron migration tracked in issue containerd#4613.

Converts the three syslog log-driver tests (TestSyslogNetwork,
TestSyslogFacilities, TestSyslogFormat) from the legacy testutil.Base
pattern to the nerdtest.Setup / test.Case framework.

Key design decisions:
- The cross-product of (network x facility x format) is expanded into
  independent SubTests via buildSyslogSubTests, mirroring the structure
  of the original table-driven loop.
- Each sub-case owns its syslog server lifecycle (Start in Setup,
  receive in Cleanup) through closure-captured variables (addr, done,
  closer, containerName, tag, msg) so the channel-based validation
  can survive the Setup -> Command -> Cleanup split.
- CA and cert are shared from the outer fixture to sub-cases via
  pointer-to-pointer (**testca.CA, **testca.Cert) populated in the
  outer testCase.Setup and read by each sub-case.
- testca.New requires testing.TB; passed as *testing.T through the
  newSyslogTestCase(t) helper rather than helpers.T() which only
  implements the narrower tig.T interface.
- Network skip logic honours rootless: the rootless path produces a
  more descriptive skip message per the existing pattern in the repo.

Validator functions (rfc5424Validator, rfc3164Validator,
emptyFormatValidator) are extracted as package-level helpers, identical
in logic to the originals.

Signed-off-by: Ogulcan Aydogan <[email protected]>
The runPacketSyslog goroutine in testsyslog has a 300ms window
(3 x 100ms deadlines) before it gives up and sends an empty string
on the done channel. When StartServer was called in Setup, the
Tigron framework overhead between Setup and Command could exceed
300ms, causing the goroutine to time out before the container sent
its first log entry -- resulting in rcvd="" and a validation failure.

Moving StartServer to the Command callback ensures the goroutine
starts immediately before nerdctl run -d, eliminating the gap.

Signed-off-by: Ogulcan Aydogan <[email protected]>
runPacketSyslog uses 4x100ms read deadlines (~400ms total). When
subtests run in parallel on slow arm runners, container startup latency
exceeds that window, causing the server to drain and send an empty
string on the done channel before the log entry arrives.

Setting NoParallel matches the original sequential t.Run behaviour.

Signed-off-by: Ogulcan Aydogan <[email protected]>
UDP and unixgram transports rely on a deadline-based loop in
runPacketSyslog. The original 4x100ms (400ms) window was too short
on slow ARM runners where container startup + syslog driver
initialization exceeds the budget, causing the server to close the
socket and send an empty string on the done channel.

Increase the pre-packet retry count from 3 to 20 (2s total). Once
the first datagram arrives, reset to the original 3 retries (400ms)
to drain any remaining bytes promptly.

Signed-off-by: Ogulcan Aydogan <[email protected]>
Replace nested loop variable shadowing (x := x) with a syslogCombination
struct that pre-builds all (network x facility x format) combinations into
a slice before creating test.Case entries. Each closure then captures the
struct value from the range variable, making the data flow explicit.

Also replace the hardcoded 0 literal in test.Expects with
expect.ExitCodeSuccess for consistency with the rest of the Tigron test
suite.

Signed-off-by: Ogulcan Aydogan <[email protected]>
Replace testutil.NewBase-based test helpers with the Tigron test
framework (nerdtest.Setup). Key changes:

- Client.Run(base, host) replaced with Client.Cmd(helpers, host)
  returning test.TestableCommand; DOCKER_CONFIG set via Setenv.
- testregistry.NewRegistry / testca.New replaced with
  nerdtest.RegistryWithBasicAuth, nerdtest.RegistryWithTokenAuth, and
  lower-level registry.NewCesantaAuthServer + registry.NewDockerRegistry
  for the token-auth/no-TLS case (HTTP registry, matching original
  behaviour).
- TestLoginPersistence: two SubTests (basic, token) each owning their
  registry lifecycle via Setup/Cleanup.
- TestLoginAgainstVariants: dynamically generated SubTests from the
  existing test-case table; inner regHost and assertion loops run
  sequentially inside Setup (equivalent coverage without nested t.Run).
- testutil.DockerIncompatible replaced with require.Not(nerdtest.Docker).
- TestAgainstNoAuth remains commented out, unchanged.

Closes containerd#4613

Signed-off-by: Ogulcan Aydogan <[email protected]>
Each invocation of a health check runs the user-defined command inside
the container via containerd's `task.Exec()` API.

We can verify this in the `probeHealthCheck` section of the healthcheck
package as follows:

```golang
func probeHealthCheck(ctx context.Context, task containerd.Task, hc *Healthcheck, processSpec *specs.Process) (*HealthcheckResult, error) {

...

	process, err := task.Exec(ctx, execID, processSpec, cio.NewCreator(
		cio.WithStreams(nil, outputBuf, outputBuf),
	))

...

	if err := process.Start(ctx); err != nil {
		log.G(ctx).Debugf("failed to start health check: %v", err)
		return nil, fmt.Errorf("start error: %w", err)
	}

	exitStatusC, err := process.Wait(ctx)
	if err != nil {
		return nil, fmt.Errorf("failed to wait for health check: %w", err)
	}
```

However, the current implementation does not release the resources
allocated during the health check once the check is complete.

As a result, for example, pipes that should normally be deleted are not
removed and continue to accumulate over time.

We can verify this behavior using the following command:

```bash
$ sudo nerdctl run -d --name=health --health-cmd="curl -f http://localhost" --health-interval=1s --health-timeout=1m0s --health-retries=3 --health-start-period=2s nginx:alpine
f2fdd8346a546bc6ef446980efdce1132a436fa63bd64a8ce6756c6197e7ec3f

$ TASK_PID=$(sudo nerdctl inspect health --format '{{.State.Pid}}')

$ SHIM_PID=$(ps -o ppid= -p $TASK_PID | tr -d ' ')

$ sudo ls -la /proc/$SHIM_PID/fd | grep pipe | head -3
lr-x------ 1 root root  64 May 17 20:51 100 -> pipe:[1093131]
lr-x------ 1 root root  64 May 17 20:52 101 -> pipe:[1092248]
lr-x------ 1 root root  64 May 17 20:52 102 -> pipe:[1092228]

$ sudo ls -la /proc/$SHIM_PID/fd | grep pipe | wc -l
16

$ sleep 10

$ sudo ls -la /proc/$SHIM_PID/fd | grep pipe | wc -l
26
```

So, this change adds a deferred `process.Delete()` after `task.Exec()` so that
the allocated resources are released when the exec process completes.

Signed-off-by: Hayato Kiwata <[email protected]>
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](docker/setup-qemu-action@ce36039...0611638)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-version: 4.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [github.com/rootless-containers/rootlesskit/v3](https://github.com/rootless-containers/rootlesskit) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/rootless-containers/rootlesskit/releases)
- [Commits](rootless-containers/rootlesskit@v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: github.com/rootless-containers/rootlesskit/v3
  dependency-version: 3.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [github.com/containerd/typeurl/v2](https://github.com/containerd/typeurl) from 2.2.3 to 2.3.0.
- [Release notes](https://github.com/containerd/typeurl/releases)
- [Commits](containerd/typeurl@v2.2.3...v2.3.0)

---
updated-dependencies:
- dependency-name: github.com/containerd/typeurl/v2
  dependency-version: 2.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
…les/github.com/containerd/typeurl/v2-2.3.0

build(deps): bump github.com/containerd/typeurl/v2 from 2.2.3 to 2.3.0
…actions/docker/setup-qemu-action-4.1.0

build(deps): bump docker/setup-qemu-action from 4.0.0 to 4.1.0
fix: update status label should call after task is started
…les/github.com/rootless-containers/rootlesskit/v3-3.0.1

build(deps): bump github.com/rootless-containers/rootlesskit/v3 from 3.0.0 to 3.0.1
…login-linux-tigron-clean

refactor: migrate login_linux_test.go to nerdtest.Setup
Migrates the non-flaky compose run tests to nerdtest.Setup():
- TestComposeRunWithEnv
- TestComposeRunWithUser
- TestComposeRunWithArgs
- TestComposeRunWithEntrypoint
- TestComposeRunWithLabel (uses nerdtest.InspectContainer)
- TestComposeRunWithVolume (uses nerdtest.InspectContainer)

Replaces the unbuffer(1) pty wrapper with cmd.WithPseudoTTY(), and
uses expect.ExitCodeSuccess instead of literal 0 for exit codes.

TestComposeRunWithServicePorts, TestComposeRunWithPublish, and
TestComposePushAndPullWithCosignVerify are intentionally left on the
legacy framework for now (flaky / complex).

Signed-off-by: sathiraumesh <[email protected]>
…ec-resources

fix(healthcheck): release exec process resources after probe
…_run_linux_test_4613

Refactor compose_run_linux_test
…n_restart_linux_test.go

test: refactor container_run_restart_linux_test.go to use Tigron
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.2 to 6.0.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@de0fac2...df4cb1c)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [github.com/opencontainers/selinux](https://github.com/opencontainers/selinux) from 1.15.0 to 1.15.1.
- [Release notes](https://github.com/opencontainers/selinux/releases)
- [Commits](opencontainers/selinux@v1.15.0...v1.15.1)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/selinux
  dependency-version: 1.15.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps the docker group with 2 updates: [github.com/docker/cli](https://github.com/docker/cli) and [github.com/moby/moby/v2](https://github.com/moby/moby).


Updates `github.com/docker/cli` from 29.5.2+incompatible to 29.5.3+incompatible
- [Commits](docker/cli@v29.5.2...v29.5.3)

Updates `github.com/moby/moby/v2` from 2.0.0-beta.15 to 2.0.0-beta.16
- [Release notes](https://github.com/moby/moby/releases)
- [Commits](moby/moby@v2.0.0-beta.15...v2.0.0-beta.16)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-version: 29.5.3+incompatible
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: docker
- dependency-name: github.com/moby/moby/v2
  dependency-version: 2.0.0-beta.16
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: docker
...

Signed-off-by: dependabot[bot] <[email protected]>
dependabot Bot and others added 29 commits June 18, 2026 22:33
Bumps the docker group with 3 updates in the / directory: [github.com/docker/cli](https://github.com/docker/cli), [github.com/moby/moby/client](https://github.com/moby/moby) and [github.com/moby/moby/v2](https://github.com/moby/moby).


Updates `github.com/docker/cli` from 29.5.3+incompatible to 29.6.0+incompatible
- [Commits](docker/cli@v29.5.3...v29.6.0)

Updates `github.com/moby/moby/client` from 0.4.1 to 0.5.0
- [Release notes](https://github.com/moby/moby/releases)
- [Changelog](https://github.com/moby/moby/blob/v0.5.0/CHANGELOG.md)
- [Commits](moby/moby@v0.4.1...v0.5.0)

Updates `github.com/moby/moby/v2` from 2.0.0-beta.16 to 2.0.0-beta.18
- [Release notes](https://github.com/moby/moby/releases)
- [Commits](moby/moby@v2.0.0-beta.16...v2.0.0-beta.18)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-version: 29.6.0+incompatible
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: docker
- dependency-name: github.com/moby/moby/client
  dependency-version: 0.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: docker
- dependency-name: github.com/moby/moby/v2
  dependency-version: 2.0.0-beta.18
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: docker
...

Signed-off-by: dependabot[bot] <[email protected]>
…actions/actions/checkout-7.0.0

build(deps): bump actions/checkout from 6.0.3 to 7.0.0
…les/github.com/cyphar/filepath-securejoin-0.7.0

build(deps): bump github.com/cyphar/filepath-securejoin from 0.6.1 to 0.7.0
…les/docker-9f8b0aae82

build(deps): bump the docker group across 1 directory with 3 updates
…les/github.com/pelletier/go-toml/v2-2.4.0

build(deps): bump github.com/pelletier/go-toml/v2 from 2.3.1 to 2.4.0
…faults

fix: remove duplicated defaults from help output
Failing since the release of go1.27rc1

```
level=warning msg="[runner] Can't run linter goanalysis_metalinter: inspect: failed to load package context: could not load export data: internal error in importing \"context\" (cannot decode \"context\", export data version 4 is greater than maximum supported version 2); please report an issue"
level=error msg="Running error: can't run linter goanalysis_metalinter\ninspect: failed to load package context: could not load export data: internal error in importing \"context\" (cannot decode \"context\", export data version 4 is greater than maximum supported version 2); please report an issue"
make[1]: *** [Makefile:142: lint-go] Error 3
make[1]: Leaving directory '/home/runner/work/nerdctl/nerdctl'
make: *** [Makefile:148: lint-go-all] Error 2
```

Workaround for issue 4979

Signed-off-by: Akihiro Suda <[email protected]>
These tests have been failing on Docker since ubuntu-24.04 image 20260615.205.1.

Workaround for issue 4978

Signed-off-by: Akihiro Suda <[email protected]>
Signed-off-by: Akihiro Suda <[email protected]>
…er-tests

CI: docker: skip TestRunSeccompCapSysPtrace and TestUpdateRestartPolicy
Workaround for issue 4838

Signed-off-by: Akihiro Suda <[email protected]>
Bumps [github.com/containerd/containerd/v2](https://github.com/containerd/containerd) from 2.3.1 to 2.3.2.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](containerd/containerd@v2.3.1...v2.3.2)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd/v2
  dependency-version: 2.3.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Akihiro Suda <[email protected]>
…WithKubo-flaky

tests: mark TestIPFSAddrWithKubo flaky
…les/github.com/containerd/containerd/v2-2.3.2

build(deps): bump github.com/containerd/containerd/v2 from 2.3.1 to 2.3.2
Signed-off-by: Immanuel Tikhonov <[email protected]>
test: refactor container_run_test.go to use Tigron
…rkdir

fix: honor --workdir in compose run
…-2.3.2

Use client.WithImageConfigLabels for image config labels
…k-help

fix: clarify healthcheck help defaults
When running in rootless mode, nerdctl version now includes the
RootlessKit version as a server component, matching the format used
by docker version. The version is retrieved via the RootlessKit API
socket (rootlessutil.NewRootlessKitClient + Info(ctx)) rather than
shelling out to rootlesskit --version, which is more robust and
avoids PATH issues.

The version is only shown when rootless mode is active (i.e. when
rootlessutil.IsRootless() is true). If the API socket is unavailable
or the Info call fails, a warning is logged and the component is
shown without a version string.

Fixes containerd#4936

Signed-off-by: Aaron Mark <[email protected]>
…lesskit

feat: show RootlessKit version in nerdctl version output
@coderbirju coderbirju closed this Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.