Skip to content

feature(containerz): Add container capabilities and volume mount options tests to CNTR-1 - #5950

Open
f-sommerauer wants to merge 6 commits into
openconfig:mainfrom
f-sommerauer:cntr-1-caps-and-mount-options
Open

feature(containerz): Add container capabilities and volume mount options tests to CNTR-1#5950
f-sommerauer wants to merge 6 commits into
openconfig:mainfrom
f-sommerauer:cntr-1-caps-and-mount-options

Conversation

@f-sommerauer

@f-sommerauer f-sommerauer commented Aug 24, 2026

Copy link
Copy Markdown

Description

This PR expands the CNTR-1 (Basic container lifecycle via gnoi.Containerz) test suite with two new test specifications and implementations:

  1. CNTR-1.9: Container Capabilities Management (TestCapabilities):

    • Elevated Capabilities (ElevatedCapabilities): Validates starting containers with elevated Linux capabilities (CAP_SYS_ADMIN, CAP_NET_RAW), verifying the running state, and confirming clean teardown.
    • Dropped Capabilities (DroppedCapabilities): Validates starting containers with default capabilities removed (CAP_NET_RAW), verifying the running state, and confirming teardown.
    • Invalid Capability Rejection (InvalidCapabilityRejection): Validates that requesting non-existent capabilities (CAP_NONEXISTENT_PRIVILEGE) is rejected by the daemon (INVALID_ARGUMENT / FAILED_PRECONDITION), asserting no orphaned instances remain.
    • State Reversion: Automatically cleans up pushed container images and instances via t.Cleanup.
  2. CNTR-1.10: Volume Mount Driver Option Matrix and Reflection (TestVolumeMountOptions):

    • Validates gnoi.Containerz.CreateVolume with multi-element Linux filesystem mount option combinations:
      • rbind,rslave
      • rbind,rprivate
      • bind,rslave,ro
      • bind,ro
      • bind
    • Validates option metadata reflection and preservation in gnoi.Containerz.ListVolume (options["o"], options["device"], options["type"]).
    • Validates volume deletion and confirms absence in ListVolume.

Test Verification & Build Matrix

  • Physical Hardware Execution:
    • Device Under Test: Arista DCS-7280CR3K-32D4-F (EOS 4.34.2FX-wbb.2-DPE-CTNR).
    • Subtests Passed:
      • TestCapabilities/ElevatedCapabilities (PASS)
      • TestCapabilities/DroppedCapabilities (PASS)
      • TestCapabilities/InvalidCapabilityRejection (PASS)
      • TestVolumeMountOptions/RbindRslave (PASS)
      • TestVolumeMountOptions/RbindRprivate (PASS)
      • TestVolumeMountOptions/BindRslaveRo (PASS)
      • TestVolumeMountOptions/BindRo (PASS)
      • TestVolumeMountOptions/Bind (PASS)

…ons tests to CNTR-1

Updates feature/container/containerz/tests/container_lifecycle/:
- README.md: Document CNTR-1.9 (Capabilities) and CNTR-1.10 (Volume Mount Options Matrix).
- containerz_test.go: Implement TestCapabilities (elevated, dropped CAP_NET_RAW/CAP_SYS_CHROOT, invalid rejection) and TestVolumeMountOptions (rbind, rslave, rprivate, ro, bind matrix reflection and deletion verification).

Hardware Verification:
- Target: Arista DCS-7280CR3K-32D4-F (EOS 4.34.2FX-wbb.2-DPE-CTNR)
- Subtests passed: TestCapabilities (Elevated, Dropped, Invalid), TestVolumeMountOptions (RbindRslave, RbindRprivate, BindRslaveRo, BindRo, Bind)
@f-sommerauer
f-sommerauer requested a review from a team as a code owner August 24, 2026 15:15
@OpenConfigBot

OpenConfigBot commented Aug 24, 2026

Copy link
Copy Markdown

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request expands the gnoi.Containerz test suite by introducing two new test specifications. These additions focus on verifying the robustness of container lifecycle management, specifically regarding Linux capability configuration and complex volume mount option handling, ensuring the daemon correctly processes and reflects these parameters.

Highlights

  • Container Capabilities Management: Added test suite CNTR-1.9 to validate container capabilities, including elevated privilege assignment, default capability dropping, and rejection of invalid capabilities.
  • Volume Mount Options: Added test suite CNTR-1.10 to verify volume creation with various mount option combinations and ensure correct metadata reflection via ListVolume.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds test documentation and Go test implementations for CNTR-1.9 (Container Capabilities Management) and CNTR-1.10 (Volume Mount Driver Option Matrix and Reflection). The feedback suggests improving the tests by ensuring the pushed base image is cleaned up at the end of the test to adhere to state reversion guidelines, failing the negative capability test if the returned error code is unexpected, and failing fast using t.Fatalf if ListContainer fails.

@f-sommerauer
f-sommerauer force-pushed the cntr-1-caps-and-mount-options branch from 5540a8c to 485fe53 Compare August 25, 2026 08:13
@f-sommerauer

Copy link
Copy Markdown
Author

Hi @Abhinavkmr @alshabib,

This PR is ready for review. All review comments have been addressed:

  • Added image cleanup via t.Cleanup calling cli.RemoveImage upon test completion.
  • Updated status code assertions in InvalidCapabilityRejection to validate expected error status codes (codes.InvalidArgument, codes.FailedPrecondition, or codes.Internal).
  • Added fast-fail on container listing errors (t.Fatalf).
  • Synchronized CNTR-1.9 specification in README.md.

Multi-vendor targets have been verified to build cleanly across all vendor targets (388/388 targets) and live hardware tests pass.

@goabhinav

Copy link
Copy Markdown
Contributor

LGTM

@f-sommerauer
f-sommerauer force-pushed the cntr-1-caps-and-mount-options branch from 6b31b89 to 50bc343 Compare August 28, 2026 19:07
@f-sommerauer
f-sommerauer force-pushed the cntr-1-caps-and-mount-options branch from 6887aa4 to 24c7e71 Compare August 28, 2026 21:50
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.

4 participants