fix(go): normalize tdengine phone tags
This commit is contained in:
@@ -54,6 +54,28 @@ func TestWriterAppendsRawLocationAndMileage(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriterNormalizesPhoneTagAndRefreshesExistingChildTags(t *testing.T) {
|
||||
exec := &recordingExec{}
|
||||
writer := NewWriter(exec)
|
||||
env := sampleEnvelope()
|
||||
|
||||
if err := writer.AppendRawFrame(context.Background(), env); err != nil {
|
||||
t.Fatalf("AppendRawFrame() error = %v", err)
|
||||
}
|
||||
|
||||
createChild := findSQL(exec.calls, "USING raw_frames")
|
||||
if !strings.Contains(createChild, "'13307795425'") {
|
||||
t.Fatalf("child table phone tag should be normalized: %s", createChild)
|
||||
}
|
||||
if strings.Contains(createChild, "'013307795425'") {
|
||||
t.Fatalf("child table phone tag should not keep leading zero: %s", createChild)
|
||||
}
|
||||
refreshTag := findSQL(exec.calls, "SET TAG phone")
|
||||
if !strings.Contains(refreshTag, "'13307795425'") {
|
||||
t.Fatalf("phone tag refresh should use normalized phone: %s", refreshTag)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriterChunksOversizedParsedJSON(t *testing.T) {
|
||||
exec := &recordingExec{}
|
||||
writer := NewWriter(exec)
|
||||
|
||||
Reference in New Issue
Block a user