Skip to content

feat(oci): add the OCI module floci.oci with FlociOciContainer - #25

Merged
hectorvent merged 1 commit into
mainfrom
feat/oci
Oct 14, 2026
Merged

hectorvent merged 1 commit into
mainfrom
feat/oci

Conversation

@hectorvent

Copy link
Copy Markdown
Member

Summary

Adds floci.oci. FlociOciContainer starts floci/floci-oci on the shared core: a config dataclass per emulator service (enabled, plus mock for Functions and OKE, the two that spawn containers), Docker socket detection, a TLS config, reset, and the identity an OCI SDK signs with: region, tenancy, namespace, user OCID, fingerprint, a throwaway RSA key, the Python SDK config dict and an OCI config-file profile.

The key is generated with cryptography, which is imported only when a key is asked for and offered as the optional extra testcontainers-floci[oci]. It is not a runtime dependency, and you can pass your own key instead.

Integration tests run against the pinned floci/floci-oci:0.4.2 with the oci SDK, a dev dependency: health, an Object Storage round trip, the config-file profile, reset, a unique namespace per start, and HTTPS readiness. No container-spawning service is exercised.

One test is a strict xfail: with auth.require-signature, that emulator release also answers 401 on its health path, so the container never reports ready. The test will start failing, and so flag itself, once the emulator is fixed.

Related issue

No issue. This is the OCI step of the multi-cloud plan for the Testcontainers family: one repo per language, one module per cloud on a shared core. It follows the Azure and GCP modules and completes the four clouds.

Type of change

  • Bug fix (fix: commit)
  • New feature (feat: commit)
  • Breaking change (feat!: commit or BREAKING CHANGE: footer)
  • Documentation or chore

Checklist

  • ruff check . && ruff format --check . && mypy floci && pytest -m "not integration" passes, and pytest -m integration if Docker is available
  • New or changed behaviour is covered by tests
  • All commit messages follow Conventional Commits (feat:, fix:, chore:, etc.)
  • Commits are signed off for the DCO (git commit -s)
  • I have no more than 2 open, non-draft pull requests and no more than 4 open pull requests in total (drafts included) in this repository (maintainers and dependency bots are exempt).

FlociOciContainer starts floci/floci-oci on the shared core: a config dataclass per emulator service (enabled, plus mock for Functions and OKE), Docker socket detection, TLS config, and the identity an OCI SDK signs with: region, tenancy, namespace, user OCID, fingerprint, a throwaway RSA key, the Python SDK config dict and an OCI config-file profile.

The key is generated with cryptography, imported only when a key is asked for and offered as the optional extra testcontainers-floci[oci]; it is not a runtime dependency.

Integration tests run on the pinned floci/floci-oci:0.4.2 with the oci SDK, a dev dependency. One is a strict xfail: with auth.require-signature that release also answers 401 on its health path, so the container never reports ready.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium impact] Adds a new OCI cloud emulator module alongside existing AWS, Azure, GCP.

The PR appears safe to merge, with a non-blocking gap in integration coverage for custom identity settings.

Findings

  1. P2 Custom identity goes untested ▶

Summary

Adds floci.oci with FlociOciContainer on the shared container core.

  • The OCI container gives SDK clients a local emulator and signing config.
  • Tests can switch OCI services and TLS settings with typed options.

hectorvent explicitly acknowledges that signature-required readiness fails in the pinned emulator and records it with a strict expected-failure test. hectorvent also states that container-spawning services are not exercised.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Test[Test setup] --> Container[FlociOciContainer]
  Config[Service and TLS settings] --> Container
  Container --> Core[Shared container core]
  Core --> Emulator[Floci OCI emulator]
  Container --> Identity[SDK config and signing key]
  Identity --> Client[OCI SDK client]
  Core --> Endpoint[Mapped endpoint]
  Endpoint --> Client
  Client --> Emulator
Loading

Reviews (1) · Last reviewed commit: "feat(oci): add the OCI module floci.oci ..." · Reviewed by Greptile

Comment thread tests/test_oci.py
Comment on lines +106 to +117
def test_identity_overrides() -> None:
c = FlociOciContainer()
assert c.with_region("eu-frankfurt-1").with_namespace("my-ns") is c
c.with_tenancy_id("ocid1.tenancy.oc1..other")
assert c.get_region() == "eu-frankfurt-1"
assert c.get_namespace() == "my-ns"
assert c.get_tenancy_id() == "ocid1.tenancy.oc1..other"
assert c.env["FLOCI_OCI_DEFAULT_REGION"] == "eu-frankfurt-1"
assert c.env["FLOCI_OCI_DEFAULT_NAMESPACE"] == "my-ns"
assert c.env["FLOCI_OCI_DEFAULT_TENANCY_ID"] == "ocid1.tenancy.oc1..other"
assert c.get_config()["tenancy"] == "ocid1.tenancy.oc1..other"
assert c.get_config()["region"] == "eu-frankfurt-1"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Custom identity goes untested

test_identity_overrides checks the values held by Python, but no integration test starts the emulator with with_tenancy_id or with_namespace. A wrong environment variable name would pass this test while the emulator kept its defaults.

Add a pinned-image test that changes both values, checks get_namespace() through the SDK, and confirms that signed and unsigned requests see the same bucket.

Knowledge Base Used:

@hectorvent
hectorvent merged commit 3429485 into main Oct 14, 2026
10 checks passed
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.

1 participant