snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
This commit is contained in:
113
server/pkg/dal/main_test.go
Normal file
113
server/pkg/dal/main_test.go
Normal file
@@ -0,0 +1,113 @@
|
||||
package dal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type (
|
||||
simpleAttribute struct {
|
||||
ident string
|
||||
source string
|
||||
expr string
|
||||
primary bool
|
||||
multivalue bool
|
||||
t Type
|
||||
}
|
||||
|
||||
simpleRow map[string]any
|
||||
)
|
||||
|
||||
func saToMapping(sa ...simpleAttribute) []AttributeMapping {
|
||||
out := make([]AttributeMapping, 0, len(sa))
|
||||
for _, a := range sa {
|
||||
out = append(out, a)
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
func saToAggAttr(sa ...simpleAttribute) []AggregateAttr {
|
||||
out := make([]AggregateAttr, 0, len(sa))
|
||||
for _, a := range sa {
|
||||
aux := AggregateAttr{
|
||||
RawExpr: a.expr,
|
||||
Identifier: a.ident,
|
||||
Type: a.t,
|
||||
}
|
||||
if aux.RawExpr == "" {
|
||||
aux.RawExpr = a.source
|
||||
}
|
||||
if aux.RawExpr == "" {
|
||||
aux.RawExpr = a.ident
|
||||
}
|
||||
out = append(out, aux)
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
func (sa simpleAttribute) Properties() MapProperties {
|
||||
return MapProperties{
|
||||
IsPrimary: sa.primary,
|
||||
Type: sa.t,
|
||||
IsMultivalue: sa.multivalue,
|
||||
}
|
||||
}
|
||||
|
||||
func (sa simpleAttribute) Identifier() (ident string) {
|
||||
return sa.ident
|
||||
}
|
||||
|
||||
func (sa simpleAttribute) Source() (expr string) {
|
||||
if sa.source != "" {
|
||||
return sa.source
|
||||
}
|
||||
|
||||
return sa.ident
|
||||
}
|
||||
|
||||
func (sa simpleAttribute) Expression() (expr string) {
|
||||
if sa.expr != "" {
|
||||
return sa.expr
|
||||
}
|
||||
|
||||
if sa.source != "" {
|
||||
return sa.source
|
||||
}
|
||||
|
||||
return sa.ident
|
||||
}
|
||||
|
||||
func bootstrapAggregate(rootTest *testing.T, run func(context.Context, *testing.T, *Aggregate, Buffer)) {
|
||||
bootstrapAggregateNoOpt(rootTest, run)
|
||||
}
|
||||
|
||||
func bootstrapAggregateNoOpt(rootTest *testing.T, run func(context.Context, *testing.T, *Aggregate, Buffer)) {
|
||||
rootTest.Run("no optimization", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
buff := InMemoryBuffer()
|
||||
agg := &Aggregate{}
|
||||
|
||||
run(ctx, t, agg, buff)
|
||||
})
|
||||
}
|
||||
|
||||
func (r simpleRow) CountValues() map[string]uint {
|
||||
out := make(map[string]uint)
|
||||
|
||||
for k := range r {
|
||||
out[k]++
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
func (r simpleRow) GetValue(k string, place uint) (any, error) {
|
||||
return r[k], nil
|
||||
}
|
||||
|
||||
func (r simpleRow) SetValue(k string, place uint, v any) error {
|
||||
r[k] = v
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user