bf9395e022
CI / license-header (push) Has been skipped
CI / e2e-dry-run (push) Has been skipped
CI / fast-gate (push) Failing after 0s
Test PR Label Logic / test-pr-labels (push) Failing after 1s
Skill Format Check / check-format (push) Failing after 2s
CI / security (push) Failing after 5s
CI / unit-test (push) Has been skipped
CI / lint (push) Has been skipped
CI / script-test (push) Has been skipped
CI / deterministic-gate (push) Has been skipped
CI / coverage (push) Has been skipped
CI / results (push) Has been cancelled
CI / deadcode (push) Has been cancelled
CI / e2e-live (push) Has been cancelled
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package apps
|
|
|
|
import "testing"
|
|
|
|
func TestAppTablesPath_ReusesExistingURL(t *testing.T) {
|
|
if got := appTablesPath("app_x"); got != "/open-apis/spark/v1/apps/app_x/tables" {
|
|
t.Fatalf("appTablesPath = %q (want existing /apps/{id}/tables, not /db/tables)", got)
|
|
}
|
|
}
|
|
|
|
func TestAppTablePath_EncodesSegments(t *testing.T) {
|
|
if got := appTablePath("app_x", "my table"); got != "/open-apis/spark/v1/apps/app_x/tables/my%20table" {
|
|
t.Fatalf("appTablePath = %q", got)
|
|
}
|
|
}
|
|
|
|
func TestAppSQLPath_ReusesExistingURL(t *testing.T) {
|
|
if got := appSQLPath("app_x"); got != "/open-apis/spark/v1/apps/app_x/sql_commands" {
|
|
t.Fatalf("appSQLPath = %q (want /apps/{id}/sql_commands)", got)
|
|
}
|
|
}
|
|
|
|
func TestAppDbEnvCreatePath_NewURL(t *testing.T) {
|
|
// db-env-create 是本期新增接口,URL 走 /db_dev_init(与上面三条复用 URL 不同)。
|
|
if got := appDbEnvCreatePath("app_x"); got != "/open-apis/spark/v1/apps/app_x/db_dev_init" {
|
|
t.Fatalf("appDbEnvCreatePath = %q", got)
|
|
}
|
|
}
|
|
|
|
func TestRequireAppID_BlankRejected(t *testing.T) {
|
|
if _, err := requireAppID(" "); err == nil {
|
|
t.Fatal("expected error for blank app-id")
|
|
}
|
|
got, err := requireAppID(" app_x ")
|
|
if err != nil || got != "app_x" {
|
|
t.Fatalf("requireAppID trimmed = %q err=%v", got, err)
|
|
}
|
|
}
|