Skip to content
Merged
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ NO_COLOR=1 volcano databases list
| Element | CLI can… | Commands | Details |
|---|---|---|---|
| Account / auth | sign up, log in/out | `signup`, `login`, `logout` | [authentication.md](authentication.md) |
| Project | create, list, get, delete, select | `projects …`, `use` | below |
| Project | create, list, get, delete, select, get anon keys | `projects …`, `use` | below |
| Functions | deploy, invoke, inspect, schedule, alias | `functions …` | [functions.md](functions.md) |
| Databases | create, inspect, delete, migrate | `databases …`, `migrations …` | [databases.md](databases.md) |
| Storage | manage buckets, objects, policies | `storage …` | [storage.md](storage.md) |
Expand All @@ -90,6 +90,7 @@ volcano projects create my-app # create a project
volcano projects list # list your projects
volcano use my-app # set the active project
volcano projects get # details for the active project
volcano projects keys # anon (publishable) API keys for the browser/SDK
volcano projects delete my-app # delete
```

Expand Down
4 changes: 2 additions & 2 deletions docs/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ it using its connection string.

| Operation | Command |
|---|---|
| Create | `volcano databases create <name> [--type …] [--region ] [--pg-version …]` |
| Create | `volcano databases create <name> [--type …] [--region aws-<aws-region>] [--pg-version …]` |
| List | `volcano databases list` |
| Get | `volcano databases get <name> [--show-connection-string]` |
| Delete | `volcano databases delete <name>` |
Expand All @@ -36,7 +36,7 @@ Prefix with `cloud` to force the cloud target.
```bash
# Create a database (defaults to type volcano-db-xs)
volcano databases create app
volcano databases create app --type volcano-db-s --region us-east-1
volcano databases create app --type volcano-db-s --region aws-us-east-1

# Show the connection string
volcano databases get app --show-connection-string
Expand Down
17 changes: 13 additions & 4 deletions internal/api/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/Kong/volcano-cli/internal/apiclient"
"github.com/Kong/volcano-cli/internal/version"
)

Expand Down Expand Up @@ -528,7 +529,7 @@ func TestFunctionMethodsUseGeneratedRoutes(t *testing.T) {

runtimeLogs, err := client.GetFunctionLogs(context.Background(), projectID, functionID, 50, "fn-next")
require.NoError(t, err)
assert.Equal(t, "function runtime", runtimeLogs.Data[0].Message)
assert.Equal(t, "function runtime", logSearchEventBody(t, runtimeLogs.Data[0]))
require.Len(t, logSearchBodies, 1)
runtimeResource, ok := logSearchBodies[0]["resource"].(map[string]any)
require.True(t, ok)
Expand All @@ -539,7 +540,7 @@ func TestFunctionMethodsUseGeneratedRoutes(t *testing.T) {

deploymentLogs, err := client.GetFunctionDeploymentLogs(context.Background(), projectID, functionID, deploymentID, 75, "dep-next")
require.NoError(t, err)
assert.Equal(t, "deployment build", deploymentLogs.Data[0].Message)
assert.Equal(t, "deployment build", logSearchEventBody(t, deploymentLogs.Data[0]))
require.Len(t, logSearchBodies, 2)
buildResource, ok := logSearchBodies[1]["resource"].(map[string]any)
require.True(t, ok)
Expand Down Expand Up @@ -738,11 +739,11 @@ func logSearchIsBuild(body map[string]any) bool {
return hasDeployments
}

func logsResponse(message string) map[string]any {
func logsResponse(body string) map[string]any {
return map[string]any{
"data": []any{
map[string]any{
"message": message,
"body": body,
"timestamp": "2025-10-09T08:53:20Z",
},
},
Expand All @@ -753,6 +754,14 @@ func logsResponse(message string) map[string]any {
}
}

func logSearchEventBody(t *testing.T, event apiclient.LogSearchEvent) string {
t.Helper()
require.NotNil(t, event.Body)
body, err := event.Body.AsLogSearchEventBody0()
require.NoError(t, err)
return body
}

func writeAPIJSON(t *testing.T, w http.ResponseWriter, status int, value any) {
t.Helper()
w.Header().Set("Content-Type", "application/json")
Expand Down
4 changes: 2 additions & 2 deletions internal/api/frontends_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func TestFrontendDomainAndLogsMethodsUseGeneratedRoutes(t *testing.T) {

runtimeLogs, err := client.GetFrontendLogs(context.Background(), projectID, frontendID, 50, "fe-next")
require.NoError(t, err)
assert.Equal(t, "frontend runtime", runtimeLogs.Data[0].Message)
assert.Equal(t, "frontend runtime", logSearchEventBody(t, runtimeLogs.Data[0]))
require.Len(t, logSearchBodies, 1)
runtimeResource, ok := logSearchBodies[0]["resource"].(map[string]any)
require.True(t, ok)
Expand All @@ -135,7 +135,7 @@ func TestFrontendDomainAndLogsMethodsUseGeneratedRoutes(t *testing.T) {

deploymentLogs, err := client.GetFrontendDeploymentLogs(context.Background(), projectID, frontendID, deploymentID, 75, "dep-next")
require.NoError(t, err)
assert.Equal(t, "frontend build", deploymentLogs.Data[0].Message)
assert.Equal(t, "frontend build", logSearchEventBody(t, deploymentLogs.Data[0]))
require.Len(t, logSearchBodies, 2)
buildResource, ok := logSearchBodies[1]["resource"].(map[string]any)
require.True(t, ok)
Expand Down
4 changes: 2 additions & 2 deletions internal/api/log_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestStreamProjectLogsRequestAndEvents(t *testing.T) {
_, _ = w.Write([]byte(": connected\n\n"))
_, _ = w.Write([]byte("id: next-id\n"))
_, _ = w.Write([]byte("event: log\n"))
_, _ = w.Write([]byte(`data: {"id":"log-1","message":"build finished","timestamp":"2025-10-09T08:53:20Z","resource":{"type":"function","id":"` + functionID.String() + `"},"deployment":{"id":"` + deploymentID.String() + `"}}` + "\n\n"))
_, _ = w.Write([]byte(`data: {"id":"log-1","body":"build finished","timestamp":"2025-10-09T08:53:20Z","resource":{"type":"function","id":"` + functionID.String() + `"},"deployment":{"id":"` + deploymentID.String() + `"}}` + "\n\n"))
_, _ = w.Write([]byte("event: warning\n"))
_, _ = w.Write([]byte(`data: {"error":"temporary read failure"}` + "\n\n"))
}))
Expand Down Expand Up @@ -72,7 +72,7 @@ func TestStreamProjectLogsRequestAndEvents(t *testing.T) {
require.NotNil(t, event.Log)
assert.Equal(t, "next-id", event.ID)
assert.Equal(t, "log-1", event.Log.Id)
assert.Equal(t, "build finished", event.Log.Message)
assert.Equal(t, "build finished", logSearchEventBody(t, *event.Log))
assert.Equal(t, time.Date(2025, 10, 9, 8, 53, 20, 0, time.UTC), event.Log.Timestamp)

event, err = stream.Next()
Expand Down
Loading