Skip to content

TPT-4130: Feature/dbaas valkey integration - #1047

Open
anmsharm1 wants to merge 40 commits into
linode:mainfrom
anmsharm1:feature/dbaas_valkey_integration
Open

anmsharm1 wants to merge 40 commits into
linode:mainfrom
anmsharm1:feature/dbaas_valkey_integration

Conversation

@anmsharm1

@anmsharm1 anmsharm1 commented Sep 18, 2026 •

Copy link
Copy Markdown

📝 Description

- TPT-4130
This change set adds full Valkey database support to the Linode API client and covers it end-to-end with unit and integration tests.

It was developed and staged originally across four related PRs:

  1. Shared database data model update for available_restore_times
  2. Core Valkey database types and serialization support
  3. Valkey client methods and shared engine/status handling
  4. Integration coverage for Valkey lifecycle and config catalog operations

This PR adds support for available_restore_times on the shared Database model, Valkey database response deserialization, Valkey create/update option models, client methods for list/get/create/update/delete, SSL, credentials, patch, suspend/resume and advanced config.

  • The shared engine mapping and database status polling support for Valkey has also been updated.
  • Integration tests covering Valkey lifecycle management and configuration metadata have been added.

This follows the existing database patterns used by MySQL/PostgreSQL and ensures Valkey behaves consistently within the shared client surface.

✔️ How to Test

Here are some notes I took for doing my local development environment setup for linodego development:
linodego developer setup

What are the steps to reproduce the issue or verify the changes?
The test suite helps validate:

  • available_restore_times deserializes correctly for both Valkey and PostgreSQL response shapes
  • Valkey database objects deserialize correctly, including nullable fields and engine config metadata
  • Valkey create/update requests serialize correctly
  • Valkey client endpoints work for database lifecycle operations
  • Valkey config catalog metadata is retrieved and validated
  • Status polling and lifecycle flows behave as expected for Valkey databases

How do I run the relevant unit/integration tests?

Unit tests

cd test
go test ./unit/... -run '^Test(UnmarshalDatabase|UnmarshalValkeyDatabase|MarshalValkey|ListDatabaseValkey|DatabaseValkey|Valkey)' -v
go test ./unit/...

Integration tests

Linodego’s integration tests can exercise the real API against a live Linode account, using the same client code that users call in production. They typically create or mutate real database resources, wait for the resource to reach the expected state, assert on the returned fields and lifecycle behavior, and then clean up so the tests validate end-to-end behavior rather than just mocked JSON parsing.

To trigger the live tests, a LINODE_TOKEN should be set an env var,

cd test
LINODE_TOKEN=your_token ENABLE_CLOUD_FW=false go test ./integration/... -run '^TestDatabase(_Valkey_Suite|Valkey_EngineConfig_Get)$' -v

@lgarber-akamai
lgarber-akamai requested review from a team, ezilber-akamai and psnoch-akamai and removed request for a team September 22, 2026 14:46
@anmsharm1 anmsharm1 changed the title Feature/dbaas valkey integration TPT-4130 : Feature/dbaas valkey integration Sep 22, 2026
@anmsharm1 anmsharm1 changed the title TPT-4130 : Feature/dbaas valkey integration - TPT-4130 : Feature/dbaas valkey integration Sep 25, 2026
@anmsharm1 anmsharm1 changed the title - TPT-4130 : Feature/dbaas valkey integration TPT-4130 : Feature/dbaas valkey integration Sep 25, 2026
Comment thread databases.go
type DatabaseFork struct {
Source int `json:"source"`
RestoreTime *time.Time `json:"-,omitzero"`
RestoreTime *time.Time `json:"restore_time,omitzero"`

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.

Can this be changed back to json:"-"? RestoreTime is unmarshaled explicitly in UnmarshalJSON, so it should be excluded from the default JSON unmarshaling.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'd added this as part of this commit. Users can provide an explicit restore time for the fork-to-restore path for point-in-time-recovery supporting database engines. To clarify the semantics, would reverting to - make json.Marshal to omit the field for engines like Valkey, so on the marshalling path the user reading this response may not identify what restore time was used?

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.

Yes, reverting to - would indeed omit this field from json.Marshal. I noticed that fork is no longer listed as a parameter in the API docs for creating MySQL, PostgreSQL, or Valkey databases. Do you know if this is intentional?

If fork is still meant to be a settable field during database creation, then I agree that changing it from - to restore_time makes sense.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, I verified that in the current API documentation for MySQL, PostgreSQL, and Valkey, Fork restore is supported and each endpoint documents creating or restoring a database, and the OpenAPI request schema has a separate restore branch with a fork object. source is required, while restore_time is optional. It appears the fork fields aren’t shown in the regular create parameter list because create and restore are represented as separate request-body schemas.

The restore_time tag change is intentional. DatabaseFork.UnmarshalJSON parses the timestamp explicitly, but the tag is also needed to marshal it into fork-create requests. this should be covered by new unit test that verifies the request contains fork.restore_time.

@ezilber-akamai ezilber-akamai 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.

Thanks for the contribution!

@anmsharm1
anmsharm1 marked this pull request as ready for review October 13, 2026 15:36
@anmsharm1
anmsharm1 requested review from a team as code owners October 13, 2026 15:36
@anmsharm1
anmsharm1 requested review from lgarber-akamai and mawilk90 and removed request for a team October 13, 2026 15:36
@zliang-akamai
zliang-akamai requested a balanced review from Copilot October 13, 2026 16:42

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.

Comment thread databases.go
Comment thread test/integration/fixtures/TestDatabase_Valkey_Suite.yaml Outdated
Comment thread test/unit/fixtures/valkey_database_unmarshal_engine_config.json Outdated
Comment thread valkey.go
ID int `json:"id"`
Status DatabaseStatus `json:"status"`
Label string `json:"label"`
Hosts DatabaseHost `json:"hosts"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@anmsharm1 Does copilot make sense here? Can you look into this?

Comment thread valkey.go
Comment thread valkey.go Outdated
Comment thread valkey.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution contributions from the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants