Skip to content

TPT-4130: add support for valkey as a new managed database - #759

Open
anmsharm1 wants to merge 4 commits into
linode:devfrom
anmsharm1:DBAAS1-1818
Open

anmsharm1 wants to merge 4 commits into
linode:devfrom
anmsharm1:DBAAS1-1818

Conversation

@anmsharm1

Copy link
Copy Markdown

📝 Description

This PR adds support for Valkey as a new managed database type in linode python sdk

What does this PR do and why is this change necessary?
TPT-4130 is tracking InnerSource DX tools initiative changes covering Managed Database Valkey as an addition to the list of supported database engine type. The support for Valkey is already released to APIv4 and is live in production (as a limited availability offering). Adding this support in linodeapiv4-python sdk will help us prepare to announce Valkey as GA/

✔️ How to Test

What are the steps to reproduce the issue or verify the changes?

  • Unit test coverage has been updated
# Install development dependencies (if needed)
make dev-install

# Run the focused Valkey unit tests
python -m pytest test/unit/groups/valkey_test.py test/unit/objects/valkey_test.py -q

# Run the full mocked unit suite
make test-unit

# Check the Valkey integration tests without making live API calls
python -m pytest test/integration/models/database/test_valkey.py -q

How do I run the relevant unit/integration tests?
I setup LINODE_TOKEN env var and ran, based on documentation:

SKIP_E2E_FIREWALL=1 RUN_VALKEY_DB_TESTS=true python -m pytest test/integration/models/database/test_valkey.py -q

Copilot AI 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.

🟡 Changes recommended

An early private-network test failure can trigger subnet/VPC cleanup before database deletion, causing cleanup timeouts and leaving resources behind.

1 open issue
What changed in this PR

Adds Valkey managed database support to the SDK’s existing database group and resource models.

Changes:

  • Adds Valkey discovery, creation, snapshot forking, and lifecycle operations.
  • Introduces typed configuration options, private-network support, and restore-time metadata.
  • Adds mocked unit coverage, API fixtures, and opt-in live integration tests.
File Description
test/​unit/​objects/​valkey_test.py Tests model loading, updates, caching, and lifecycle actions.
test/​unit/​groups/​valkey_test.py Tests discovery, creation, configuration, and snapshot forking.
test/​unit/​groups/​database_test.py Updates collection counts for Valkey fixtures.
test/​integration/​models/​database/​test_valkey.py Adds opt-in lifecycle, fork, and private-network tests.
test/​integration/​models/​database/​test_database.py Accepts Valkey in engine discovery.
test/​fixtures/​databases_valkey_instances.json Provides a representative Valkey instance response.
test/​fixtures/​databases_valkey_instances_123_suspend.json Adds a suspend response fixture.
test/​fixtures/​databases_valkey_instances_123_ssl.json Adds an SSL certificate fixture.
test/​fixtures/​databases_valkey_instances_123_resume.json Adds a resume response fixture.
test/​fixtures/​databases_valkey_instances_123_patch.json Adds a patch response fixture.
test/​fixtures/​databases_valkey_instances_123_credentials.json Adds a credentials response fixture.
test/​fixtures/​databases_valkey_instances_123_credentials_reset.json Adds a credential-reset response fixture.
test/​fixtures/​databases_valkey_config.json Defines configuration catalog metadata for tests.
test/​fixtures/​databases_types.json Adds Valkey plan information.
test/​fixtures/​databases_instances.json Adds generic Valkey discovery and restore-time data.
test/​fixtures/​databases_engines.json Adds the Valkey engine to discovery fixtures.
linode_api4/​objects/​database.py Adds Valkey models, lifecycle actions, and generic model translation.
linode_api4/​groups/​database.py Adds Valkey listing, configuration, creation, and fork methods.

Review effort: Balanced

…etwork teardown to prevent leaked resources'

Adjusted text logic to account for the test scenario where If the private-network test fails before detaching the database, the fixture’s cleanup runs after the test’s subnet/VPC finalizers, so network deletion can fail while the database is still attached. The change is to register database cleanup on request.node so it runs before subnet and VPC cleanup.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@anmsharm1
anmsharm1 marked this pull request as ready for review November 23, 2026 19:48
@anmsharm1
anmsharm1 requested review from a team as code owners November 23, 2026 19:48
@anmsharm1
anmsharm1 requested review from hmorris3293 and psnoch-akamai and a balanced review from Copilot and removed request for a team November 23, 2026 19:48

Copilot AI 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.

🔵 Needs a closer look

Credential reset and patch invalidate cached state before the POST succeeds, discarding unsaved changes if the request fails; invalidation should occur only after success.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve unsaved changes when credential reset fails

linode_api4/​objects/​database.py:650

If the credential-reset POST fails, invalidate() has already discarded unsaved changes such as label and allow_list. Send the POST first, then invalidate only on success and return its response. The same issue affects patch() at line 647.

1 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants