TDengine/tools/keeper/api/common_test.go
guozhenwei 07a943655b
test: add keeper test cases (#33319)
* test: add collect test case

* test: add zabbix test

* test: add adapter2 test

* test: add audit test

* test: add checkhealth test

* test: add common test

* test: add gen_metric test

* test: add command test

* test: add connector test

* test: add log test

* test: add web test

* test: add builder test

* test: add handle test

* test: add util test

* test: add audit test

* test: add adapter2 test

* test: modify test case
2025-10-23 18:10:30 +08:00

29 lines
541 B
Go

package api
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func Test_generateCreateDBSql(t *testing.T) {
opts := map[string]interface{}{
"precision": "ms",
"replica": 2,
"strict": true,
}
sql := generateCreateDBSql("mydb", opts)
assert.True(t, strings.HasPrefix(sql, "create database if not exists mydb"))
cases := []string{
" precision 'ms' ",
" replica 2 ",
" strict true ",
}
for _, sub := range cases {
assert.Contains(t, sql, sub)
}
assert.True(t, strings.HasSuffix(sql, " "))
}