Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:white_check_mark: Isolate CLI database automation test queue https://github.com/siyuan-note/siyuan/issues/20921

Daniel4a264b58ae42
diff --git a/kernel/cli/cmd/database_automation_test.go b/kernel/cli/cmd/database_automation_test.go
index 3532c487d5..625e694b99 100644
--- a/kernel/cli/cmd/database_automation_test.go
+++ b/kernel/cli/cmd/database_automation_test.go
@@ -1,6 +1,9 @@
package cmd
import (
+ "os"
+ "os/exec"
+ "path/filepath"
"testing"
"github.com/88250/lute/ast"
@@ -11,6 +14,16 @@ import (
)
func TestDatabaseItemWritesRunAutomations(t *testing.T) {
+ const child = "SIYUAN_TEST_CLI_DATABASE_AUTOMATION"
+ if os.Getenv(child) != "1" {
+ cmd := exec.Command(os.Args[0], "-test.run=^TestDatabaseItemWritesRunAutomations$", "-test.v")
+ cmd.Env = append(os.Environ(), child+"=1")
+ if output, err := cmd.CombinedOutput(); err != nil {
+ t.Fatalf("database automation subprocess: %v\n%s", err, output)
+ }
+ return
+ }
+ util.QueueDir = filepath.Join(t.TempDir(), "queue")
previousLang, previousAVLangs := util.Lang, util.AttrViewLangs
util.Lang = "en"
util.AttrViewLangs = map[string]map[string]any{"en": {"key": "Key", "select": "Select", "table": "Table"}}