Repository navigation
Conversation
Render nullable types as a readable union in database configuration tables. Cover Valkey output without changing non-nullable types. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
|
||
|
|
||
| def add_param_row(output, param_name, param_data): | ||
| def _format_param_type(param_type) -> str: |
There was a problem hiding this comment.
It looks like this is intentional, but it's worth noting in this context that the logic here makes the behavior for Valkey parameters with multiple types different from the other engines. I can't immediately produce an example for PostgreSQL, which is currently broken in the CLI (!), but I can for MySQL:
├────────────────────────────────┼────────────────────┼────────────────────┼─────────┼──────────────────────┼────────────┼────────────┼───────────────────────┼──────────────────┼────────────────────────────────┤
│ mysql.innodb_ft_server_stopwo… │ ['null', 'string'] │ db_name/table_name │ │ │ │ 1024 │ ^.+/.+$ │ NO │ This option is used to specify │
│ │ │ │ │ │ │ │ │ │ your own InnoDB FULLTEXT index │
│ │ │ │ │ │ │ │ │ │ stopword list for all InnoDB │
│ │ │ │ │ │ │ │ │ │ tables. │
├────────────────────────────────┼────────────────────┼────────────────────┼─────────┼──────────────────────┼────────────┼────────────┼───────────────────────┼──────────────────┼────────────────────────────────┤
... where the type of the parameter would be given as null | string for Valkey.
Maybe this is a question best addressed to the maintainers, but: what's the right thing to do here? Aim for consistency across the engine types? If so, should MySQL + (presumably) PG switch to the formatting applied here, or should Valkey use the existing formatting?
There was a problem hiding this comment.
I kept existing MySQL/PG output unchanged; consistent formatting can be a follow-up. I'm still defer to feedback from the maintainers, if they think we should standardize changing scope to expand mysql/pg.
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def valkey_cluster(): |
There was a problem hiding this comment.
The approach in valkey_cluster() feels like an improvement to me relative to the other database engines -- being flexible about the type, region, and engine; making sure the instance is ready before use; and sharing more details with the tests that consume the instance all seem like facially good, reasonable choices -- but there are tradeoffs that are worth explicitly considering, I think.
- One is whether we want to leave the CLI in a state where Valkey is treated very differently from PostgreSQL and MySQL. That's potentially both a maintainability issue and a source of inconsistency in the quality of the products. A plausible answer to that is to line up PG and MySQL with Valkey, though -- either in this PR or in a followup -- rather than to move in the other direction.
- Another is how comprehensive these tests are intended to be/should be. Some of the testing here arguably veers into testing the Managed Database functionality itself, which might be more than we want from these tests. The additional complexity and coverage here carries some maintenance burden that's worth taking into account. Probably this question is mostly for the maintainers.
- Somewhat relatedly: some of these steps will nontrivially increase the running time of the tests. Probably not a huge deal, but FWIW it may mean we should be more aggressive about treating these tests as long-running.
There was a problem hiding this comment.
I kept the Valkey fixture and deferred cross-engine fixture improvements. We can change if maintainer's propose otherwise.
📝 Description
What does this PR do and why is this change necessary?
Adds integration test coverage for Valkey Managed Databases, including engine and type discovery, database listing and viewing, engine configuration, credentials and SSL, suspend/resume, patching, and snapshot-based fork/restore.
Adds table output handling for
valkey-config-view, including readable formatting for nullable configuration parameter types ( backup_minute, backup_hour, valkey_memory_policy etc. ), such asinteger | nullorstring | null. This is required as Valkey’s config schema includes nullable parameter types represented as lists, such as ["integer", "null"] .The new formatting helper renders those as
integer | null. I modeledadd_param_rowthat now applies that formatting only when the Valkey handler opts in otherwise its default preserves the existing type formatting for PostgreSQL and MySQL.✔️ How to Test
What are the steps to reproduce the issue or verify the changes?
Set
LINODE_CLI_TOKENto a token for an account that can create Managed Databases. The integration tests create and delete live database resources. Snapshot restore is skipped by default; setRUN_LONG_TESTS=Trueto run it.How do I run the relevant unit/integration tests?
make test-unit— passed.make test-int TEST_SUITE=database TEST_CASE=valkey TEST_ARGS='-v'— 10 passed, 1 skipped, 17 deselected.