[APIE-989] Initial generated code for Symphony control plane APIs (Don't Merge)#3331
[APIE-989] Initial generated code for Symphony control plane APIs (Don't Merge)#3331Channing Dong (channingdong) wants to merge 1 commit intomainfrom
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
| sigs.k8s.io/yaml v1.3.0 // indirect | ||
| ) | ||
|
|
||
| replace github.com/confluentinc/ccloud-sdk-go-v2/rtce => /Users/channingdong/git/go/src/github.com/confluentinc/cli-terraform-generator/test-suites/specs/rtce |
There was a problem hiding this comment.
This line will be removed after the rtce APIs SDK are made available to the public.
There was a problem hiding this comment.
Pull request overview
Introduces initial generated CLI and client support for Symphony/RTCE control plane APIs, including RTCE regions and RTCE topic CRUD, plus corresponding test-server routes and tests.
Changes:
- Add RTCE API client wiring and list/create/get/update/delete helpers in
pkg/ccloudv2. - Add
confluent rtcecommand group withregion listandrtce-topicsubcommands. - Add test-server handlers/routes and new integration/live tests for RTCE commands.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/ccloudv2/client.go |
Wires an RTCE SDK client into the shared v2 client. |
pkg/ccloudv2/rtce.go |
Adds RTCE API wrapper methods (topics + regions). |
internal/command.go |
Registers the new rtce top-level command group. |
internal/rtce/* |
Implements RTCE CLI commands (regions + rtce-topic CRUD + autocomplete). |
test/test-server/ccloudv2_router.go |
Registers RTCE routes in the test server. |
test/test-server/region_handler.go |
Adds test-server handler for RTCE regions. |
test/test-server/rtce_topic_handler.go |
Adds test-server handlers for RTCE topics endpoints. |
test/region_test.go |
Adds integration tests for rtce region list. |
test/rtce_topic_test.go |
Adds integration tests for rtce rtce-topic commands. |
test/live/region_live_test.go |
Adds live test for RTCE region listing. |
test/live/rtce_topic_live_test.go |
Adds live CRUD test for RTCE topics. |
go.mod |
Adds RTCE SDK dependency (currently with a local replace). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func (c *rtceTopicCommand) autocompleteRtceTopics() []string { | ||
| rtceTopics, err := c.V2Client.ListRtceTopics("", "", "", "") | ||
| if err != nil { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
This autocomplete implementation calls ListRtceTopics with empty environment/cluster, even though the normal list/describe/delete flows derive these from the current CLI context. That likely makes autocomplete return no suggestions (errors are swallowed) when the backend requires those scopes. Fetch environment + kafka cluster from context (like other autocomplete helpers do) and pass them through.
| // Variables | ||
| regionName := uniqueName("region") | ||
|
|
||
| // Cleanup (LIFO) | ||
|
|
||
| steps := []CLILiveTest{ | ||
| { | ||
| Name: "List rtce regions", | ||
| Args: "rtce region list", | ||
| UseStateVars: true, | ||
| ExitCode: 0, | ||
| Contains: []string{regionName}, | ||
| }, |
There was a problem hiding this comment.
regionName is randomly generated but never used to create a region; asserting Contains: []string{regionName} will be flaky/always fail against real environments. Either assert on a known region value (from config) or remove the Contains check and only validate exit code/output structure.
There was a problem hiding this comment.
This is a live test specific issue, we will address it in the upcoming commits.
| cmd := &cobra.Command{ | ||
| Use: "create", | ||
| Short: "Create a rtce topic.", | ||
| Args: cobra.NoArgs, | ||
| RunE: c.create, | ||
| } |
There was a problem hiding this comment.
The command is configured with cobra.NoArgs, but the tests/live tests invoke rtce rtce-topic create <name> .... As written, the CLI will error on the extra positional arg. Update the command to accept the positional identifier (e.g., Use: "create <topic-name>" + cobra.ExactArgs(1)) and plumb the arg into the create request, or update the tests to match the no-arg UX.
There was a problem hiding this comment.
It should be no-arg, we need to update the corresponding tests/live tests.
| tests := []CLITest{ | ||
| {args: "rtce rtce-topic create test-name --cloud aws --description \"Customer orders table for real-time analytics\" --region us-west-2 --topic-name orders_topic", fixture: "rtce/rtce-topic/create.golden"}, | ||
| } |
There was a problem hiding this comment.
These integration tests reference golden fixtures under test/fixtures/output/rtce/..., but that directory/files do not exist in the repository right now. Add the corresponding golden files (and any required input fixtures) or the tests will fail at runtime.
| tests := []CLITest{ | ||
| {args: "rtce region list", fixture: "rtce/region/list.golden"}, | ||
| {args: "rtce region list --region us-east-2", fixture: "rtce/region/list-region.golden"}, | ||
| {args: "rtce region list -o json", fixture: "rtce/region/list-json.golden"}, | ||
| {args: "rtce region list -o yaml", fixture: "rtce/region/list-yaml.golden"}, |
There was a problem hiding this comment.
These integration tests reference golden fixtures under test/fixtures/output/rtce/..., but that directory/files do not exist in the repository right now. Add the corresponding golden files (and any required input fixtures) or the tests will fail at runtime.
| switch topic_name { | ||
| case "invalid": | ||
| w.WriteHeader(http.StatusNotFound) | ||
| default: |
There was a problem hiding this comment.
For consistency with other test-server handlers (and to match CLI error parsing), the invalid-resource path should write a structured error body (e.g., via writeResourceNotFoundError(w)) rather than only setting a 404 status with an empty body.
| topic_name := mux.Vars(r)["topic_name"] | ||
| switch r.Method { |
There was a problem hiding this comment.
Use Go-style camelCase for local variables. topic_name is inconsistent with the rest of this package (e.g., most handlers use id, envId, etc.). Rename to topicName for readability.
|
|
||
| replace github.com/confluentinc/ccloud-sdk-go-v2/rtce => /Users/channingdong/git/go/src/github.com/confluentinc/cli-terraform-generator/test-suites/specs/rtce |
There was a problem hiding this comment.
This replace points to a developer-local absolute path. It will break builds for everyone else and must not be committed. Remove the replace (or replace it with a repo-relative path / published module version) before merging.
| replace github.com/confluentinc/ccloud-sdk-go-v2/rtce => /Users/channingdong/git/go/src/github.com/confluentinc/cli-terraform-generator/test-suites/specs/rtce |
There was a problem hiding this comment.
We will replace this with official SDK soon, not a concern here.
| func readRtceV1RtceTopicFile(t *testing.T, filename string) rtcev1.RtceV1RtceTopic { | ||
| jsonPath := filepath.Join("..", "fixtures", "input", "rtce", "rtce_topic", filename) | ||
| jsonData, err := os.ReadFile(jsonPath) | ||
| require.NoError(t, err) |
There was a problem hiding this comment.
This handler reads RTCE topic fixtures from test/fixtures/input/rtce/..., but that fixtures directory/files are not present in the repo. Add the fixtures (and ensure the relative path matches the test runner working directory) or the test server will panic/fail when the endpoint is hit.
| func readRtceV1RegionFile(t *testing.T, filename string) rtcev1.RtceV1Region { | ||
| jsonPath := filepath.Join("..", "fixtures", "input", "rtce", "region", filename) | ||
| jsonData, err := os.ReadFile(jsonPath) | ||
| require.NoError(t, err) |
There was a problem hiding this comment.
This handler reads RTCE region fixtures from test/fixtures/input/rtce/..., but that fixtures directory/files are not present in the repo. Add the fixtures (and ensure the relative path matches the test runner working directory) or the test server will panic/fail when the endpoint is hit.
Release Notes
Breaking Changes
New Features
Bug Fixes
Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.What
Blast Radius
References
Test & Review