mirror of
https://github.com/taosdata/TDengine
synced 2026-05-24 10:09:01 +00:00
* 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
29 lines
541 B
Go
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, " "))
|
|
}
|