mirror of
https://github.com/hanzoai/o11y.git
synced 2026-10-15 12:58:33 +00:00
Hanzo CI/CD / test (linux-amd64) (push) Skipped
Hanzo CI/CD / test (linux-arm64) (push) Skipped
Hanzo CI/CD / test-advisory (push) Successful in 21m35s
Hanzo CI/CD / test-amd64 (push) Successful in 33m56s
Hanzo CI/CD / cicd (push) Successful in 3m6s
CI/CD / cicd (push) Successful in 37m4s
There is no event.descriptor to write; answer 501, not 500. Claude-Session: https://claude.ai/code/session_011i2AG9nwpiKUCVxAdDzYuU
32 lines
1.0 KiB
Go
32 lines
1.0 KiB
Go
package datastorereader
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/hanzoai/o11y/pkg/query-service/constants"
|
|
"github.com/hanzoai/o11y/pkg/query-service/model"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// Exceptions read the event fact table, scoped to the caller's org, and never
|
|
// the retired error index.
|
|
func TestListErrorsQueryReadsFactByOrg(t *testing.T) {
|
|
q := listErrorsQuery("event.fact", "", &model.ListErrorsParams{
|
|
OrderParam: "lastSeen", Order: constants.Descending, Limit: 10, Offset: 5,
|
|
})
|
|
assert.Contains(t, q, "FROM event.fact WHERE org = @org AND signal = 'error'")
|
|
assert.Contains(t, q, "GROUP BY issue")
|
|
assert.Contains(t, q, "ORDER BY lastSeen DESC LIMIT @limit OFFSET @offset")
|
|
assert.False(t, strings.Contains(q, "error_index"))
|
|
}
|
|
|
|
func TestErrorFactsNeedsTenant(t *testing.T) {
|
|
r := &DatastoreReader{TraceDB: "event", errorTable: "fact"}
|
|
_, _, apiErr := r.errorFacts(context.Background())
|
|
if assert.NotNil(t, apiErr) {
|
|
assert.Equal(t, model.ErrorForbidden, apiErr.Typ)
|
|
}
|
|
}
|