This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestBuildCanonicalHourlySummaryUnionCastsInventoryIDToBigInt(t *testing.T) {
|
||||
start := time.Unix(1700000000, 0).UTC()
|
||||
end := start.Add(24 * time.Hour)
|
||||
|
||||
query := buildCanonicalHourlySummaryUnion(start, end)
|
||||
if !strings.Contains(query, `CAST(NULL AS BIGINT) AS "InventoryId"`) {
|
||||
t.Fatalf("expected InventoryId cast to BIGINT in canonical hourly union query")
|
||||
}
|
||||
if !strings.Contains(query, `CAST(NULL AS TEXT) AS "EventKey"`) {
|
||||
t.Fatalf("expected EventKey cast to TEXT in canonical hourly union query")
|
||||
}
|
||||
if !strings.Contains(query, `CAST(NULL AS TEXT) AS "CloudId"`) {
|
||||
t.Fatalf("expected CloudId cast to TEXT in canonical hourly union query")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildCanonicalDailyRollupSummaryUnionCastsInventoryIDToBigInt(t *testing.T) {
|
||||
start := time.Unix(1700000000, 0).UTC()
|
||||
end := start.AddDate(0, 1, 0)
|
||||
|
||||
query := buildCanonicalDailyRollupSummaryUnion(start, end)
|
||||
if !strings.Contains(query, `CAST(NULL AS BIGINT) AS "InventoryId"`) {
|
||||
t.Fatalf("expected InventoryId cast to BIGINT in canonical daily rollup union query")
|
||||
}
|
||||
if !strings.Contains(query, `CAST(NULL AS TEXT) AS "EventKey"`) {
|
||||
t.Fatalf("expected EventKey cast to TEXT in canonical daily rollup union query")
|
||||
}
|
||||
if !strings.Contains(query, `CAST(NULL AS TEXT) AS "CloudId"`) {
|
||||
t.Fatalf("expected CloudId cast to TEXT in canonical daily rollup union query")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user