Skip to content

e2e: inconsistent UID/GID gating across container tools #834

Description

@shivansh-source

The e2e helpers build the "run as user" setting from the same containerTestArgs.UID/GID, but the guard differs across tools:

  • commonNewContainerCmd (tests/e2e/common.go, used by docker + nerdctl) → if a.UID != 0 && a.GID != 0
  • crictlNewContainerConfig (tests/e2e/crictl.go) → if a.UID != 0 && a.GID != 0 (gates RunAsUser/RunAsGroup)
  • ctrNewContainerCmd (tests/e2e/ctr.go) → if a.UID != 0 || a.GID != 0

With &&, a config such as UID: 1000, GID: 0 (run as user 1000, group root) drops the -u flag / RunAsUser entirely on docker, nerdctl, and crictl, while ctr honors it. The same test args produce different runtime behavior depending on the tool under test, which defeats the purpose of a shared arg struct.
|| is the correct semantics: the flag should be emitted whenever either value is non-default. 0/0 still correctly emits nothing.
Proposed fix: standardize the docker/nerdctl and crictl guards on || to match ctr. Optionally add a mismatched-pair case (e.g. UID: 65534, GID: 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions