remove @ from yaml

try to fix yml syntax

same

same

same

same2

same3

same4

same5

try with shell runner instead of dind

remove lattice from dockerfile

change path to bin

runs after linux arm64 build

change dockerfile path

same

same

add dir

better test coverage
This commit is contained in:
Todd Gruben 2021-11-03 08:48:57 -05:00
parent a79bb893af
commit e915d75df6
7 changed files with 154 additions and 5 deletions

View file

@ -10,6 +10,8 @@ include:
- key: $CI_COMMIT_REF_SLUG
paths:
- .go/pkg/mod/
variables:
GOVERSION: "1.16.9"
stages:
- lint
@ -156,3 +158,19 @@ build for darwin arm64:
artifacts:
paths:
- featurebase_darwin_arm64
# Build a FB Docker image with CI/CD and push to the GitLab registry.
build container fb:
image: docker:stable
stage: build
needs:
- "build for linux amd64"
tags:
- shell
before_script:
- echo "${DOCKER_DEPLOY_TOKEN}" | docker login -u ${DOCKER_DEPLOY_USER} --password-stdin ${CI_REGISTRY}
script:
- tag=${CI_REGISTRY_IMAGE}/server:${CI_COMMIT_REF_SLUG}
- docker build --build-arg GO_VERSION=$GOVERSION -t $tag -f .gitlab/Dockerfile .
- docker push $tag
- echo Created docker featurebase image with tag "$tag"

23
.gitlab/Dockerfile Normal file
View file

@ -0,0 +1,23 @@
FROM alpine:3.14.2
LABEL maintainer "dev@molecula.com"
LABEL org.opencontainers.image.authors="dev@molecula.com"
WORKDIR /featurebase
RUN apk add --no-cache curl jq
COPY LICENSE .
COPY NOTICE .
COPY featurebase_linux_amd64 .
RUN chmod ugo+x .
EXPOSE 10101
VOLUME /data
ENV PILOSA_DATA_DIR /data
ENV PILOSA_BIND 0.0.0.0:10101
ENV PILOSA_BIND_GRPC 0.0.0.0:20101
ENTRYPOINT ["/featurebase"]
CMD ["server"]

View file

@ -15,6 +15,7 @@
package pilosa
import (
"context"
"fmt"
"math/rand"
"reflect"
@ -625,3 +626,14 @@ func TestAE(t *testing.T) {
}
})
}
func TestTranslateIndexKey(t *testing.T) {
c := newCluster()
node0 := &topology.Node{ID: "node0"}
c.addNodeBasicSorted(node0)
c.holder = newHolderWithTempPath(t, "rbf")
_, e := c.translateIndexKey(context.Background(), "i", "a", false)
if e == nil {
t.Fatal("expecting error")
}
}

View file

@ -8220,4 +8220,77 @@ func TestToRows(t *testing.T) {
if x == nil {
t.Fatal("Shouldn't be nil ")
}
e = v.ToRows(func(*proto.RowResponse) error {
return nil
})
if e != nil {
t.Fatal("Shouldn't be err ", e)
}
v.DecimalVal = &pql.Decimal{Value: 1, Scale: 1}
e = v.ToRows(func(*proto.RowResponse) error {
return nil
})
if e != nil {
t.Fatal("Shouldn't be err ", e)
}
v.DecimalVal = nil
v.FloatVal = 3.0
e = v.ToRows(func(*proto.RowResponse) error {
return nil
})
if e != nil {
t.Fatal("Shouldn't be err ", e)
}
pfi := &pilosa.PairField{
Pair: pilosa.Pair{ID: 1, Count: 1},
Field: "f",
}
z := pfi.Clone()
if z.Pair.ID != pfi.Pair.ID {
t.Fatal("Should be equal ", z, pfi)
}
e = pfi.ToRows(func(*proto.RowResponse) error {
return nil
})
if e != nil {
t.Fatal("Shouldn't be err ", e)
}
pfk := &pilosa.PairField{
Pair: pilosa.Pair{Key: "a", Count: 1},
Field: "f",
}
o := pfk.Clone()
if o.Pair.Key != pfk.Pair.Key {
t.Fatal("Should be equal ")
}
e = pfk.ToRows(func(*proto.RowResponse) error {
return nil
})
if e != nil {
t.Fatal("Shouldn't be err ", e)
}
pfs := &pilosa.PairsField{
Pairs: []pilosa.Pair{{ID: 1, Count: 1}},
Field: "f",
}
f := pfs.Clone()
if f.Pairs[0].ID != pfs.Pairs[0].ID {
t.Fatal("Should be equal ")
}
e = pfs.ToRows(func(*proto.RowResponse) error {
return nil
})
if e != nil {
t.Fatal("Shouldn't be err ", e)
}
r4 := server.ResultUint64(1)
e = r4.ToRows(func(*proto.RowResponse) error {
return nil
})
if e != nil {
t.Fatal("Shouldn't be err ", e)
}
}

View file

@ -18,6 +18,7 @@ import (
"io"
"math/bits"
"math/rand"
"os"
"reflect"
"sort"
"strings"
@ -847,6 +848,25 @@ func (e *EasyWalker) String() string {
return e.path.String()
}
func TestDumpDot(t *testing.T) {
db := MustOpenDB(t)
defer MustCloseDB(t, db)
tx := MustBegin(t, db, true)
defer tx.Rollback()
if err := tx.CreateBitmap("x"); err != nil {
t.Fatal(err)
}
c, err := tx.Cursor("x")
if err != nil {
t.Fatal(err)
}
_, err = c.Add(1)
if err != nil {
t.Fatal(err)
}
rbf.Dumpdot(tx, 0, " ", os.Stdout)
}
func TestCursor_UpdateBranchCells(t *testing.T) {
db := MustOpenDB(t)
defer MustCloseDB(t, db)
@ -964,6 +984,9 @@ func TestCursor_SplitBranchCells(t *testing.T) {
t.Fatalf("Expecting RBLL (a branch split) got %v", after.String())
}
//
c, _ := tx.Cursor("x") //added just for dot code coverage
c.Dump("ignore for coverage")
}

View file

@ -106,7 +106,7 @@ func (c *Cursor) Dump(name string) {
fmt.Fprintf(bufStdout, "rankdir=\"LR\"\n")
fmt.Fprintf(bufStdout, "node [shape=record height=.1]\n")
dumpdot(c.tx, 0, " ", bufStdout)
Dumpdot(c.tx, 0, " ", bufStdout)
fmt.Fprintf(bufStdout, "\n}")
bufStdout.Flush()
}

View file

@ -60,8 +60,8 @@ func dotCell(b []byte, parent string, writer io.Writer) {
}
}
// dumpdot recursively writes the tree representation starting from a given page to STDERR.
func dumpdot(tx *Tx, pgno uint32, parent string, writer io.Writer) {
// Dumpdot recursively writes the tree representation starting from a given page to STDERR.
func Dumpdot(tx *Tx, pgno uint32, parent string, writer io.Writer) {
page, _, err := tx.readPage(pgno)
if err != nil {
panic(err)
@ -79,7 +79,7 @@ func dumpdot(tx *Tx, pgno uint32, parent string, writer io.Writer) {
root := fmt.Sprintf("root%d", record.Pgno)
fmt.Fprintf(writer, "%s[label=\"ROOT(%d)| %s\"]\n%s->%s\n", root, record.Pgno, record.Name, rr, root)
p := fmt.Sprintf("root%d", record.Pgno)
dumpdot(tx, record.Pgno, p, writer)
Dumpdot(tx, record.Pgno, p, writer)
}
}
@ -96,7 +96,7 @@ func dumpdot(tx *Tx, pgno uint32, parent string, writer io.Writer) {
for i, n := 0, readCellN(page); i < n; i++ {
cell := readBranchCell(page, i)
if cell.Flags&uint32(ContainerTypeBitmap) == 0 { // leaf/branch child page
dumpdot(tx, cell.ChildPgno, p, writer)
Dumpdot(tx, cell.ChildPgno, p, writer)
} else {
b := fmt.Sprintf("bm%d", cell.ChildPgno)
fmt.Fprintf(writer, "%s[label=\"BITMAP(%d) key=%d \"]\n %s -> %s\n", b, cell.ChildPgno, cell.LeftKey, p, b)