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

This commit is contained in:
upstream-mirror
2026-09-18 01:22:23 +05:00
commit 7e385fc126
8391 changed files with 1766236 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
package csv
import (
"context"
"fmt"
"os"
"testing"
"github.com/cortezaproject/corteza/server/pkg/envoy"
"github.com/cortezaproject/corteza/server/pkg/envoy/resource"
"github.com/stretchr/testify/require"
)
func parseDocument(ctx context.Context, name string) (*resource.ResourceDataset, error) {
path := fmt.Sprintf("testdata/%s.csv", name)
f, err := os.Open(path)
if err != nil {
return nil, err
}
defer f.Close()
cd := Decoder()
ii, err := cd.Decode(ctx, f, &envoy.DecoderOpts{
Name: name,
Path: path,
})
if err != nil {
return nil, err
}
rd, _ := ii[0].(*resource.ResourceDataset)
return rd, nil
}
func TestDecoder(t *testing.T) {
ctx := context.Background()
t.Run("doc 1", func(t *testing.T) {
req := require.New(t)
ds, err := parseDocument(ctx, "records_1")
req.NoError(err)
req.NotNil(ds)
req.Equal(resource.MakeIdentifiers("records_1"), ds.Identifiers())
req.Equal([]string{"id", "c1", "c2", "c3"}, ds.P.Fields())
req.Equal(uint64(3), ds.P.Count())
for i := 0; i < 3; i++ {
n, err := ds.P.Next()
req.NoError(err)
req.NotNil(n)
req.Len(n, 4)
}
n, err := ds.P.Next()
req.Nil(n)
req.Nil(err)
})
}