Repository navigation
feat(oci): add the OCI module floci.oci with FlociOciContainer - #25
Conversation
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>
|
| 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" |
There was a problem hiding this comment.
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:
Summary
Adds
floci.oci.FlociOciContainerstartsfloci/floci-ocion 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 extratestcontainers-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.2with theociSDK, 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: withauth.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
fix:commit)feat:commit)feat!:commit orBREAKING CHANGE:footer)Checklist
ruff check . && ruff format --check . && mypy floci && pytest -m "not integration"passes, andpytest -m integrationif Docker is availablefeat:,fix:,chore:, etc.)git commit -s)