Skip to content

Commit

Permalink
*: update all-in-one ready to release v0.0.5 (#73)
Browse files Browse the repository at this point in the history
* build: update all-in-one ready to release v0.0.5

* add field in eventbus info

* test: add ut for store/block/index
  • Loading branch information
wenfengwang authored May 26, 2022
1 parent 7efd88d commit c658ee8
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 336 deletions.
12 changes: 6 additions & 6 deletions deploy/all-in-one.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
- vanus-controller-1.vanus-controller.vanus.svc:2379
- vanus-controller-2.vanus-controller.vanus.svc:2379
data_dir: /data
replicas: 1
replicas: 3
metadata:
key_prefix: /vanus
topology:
Expand Down Expand Up @@ -170,7 +170,7 @@ spec:
app: vanus-gateway
spec:
containers:
- image: public.ecr.aws/vanus/gateway:5952928
- image: public.ecr.aws/vanus/gateway:v0.0.5
imagePullPolicy: Always
name: gateway
ports:
Expand All @@ -192,7 +192,7 @@ metadata:
name: vanus-trigger
namespace: vanus
spec:
replicas: 1
replicas: 2
selector:
matchLabels:
app: vanus-trigger
Expand All @@ -209,7 +209,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
image: public.ecr.aws/vanus/trigger:5952928
image: public.ecr.aws/vanus/trigger:v0.0.5
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
Expand Down Expand Up @@ -258,7 +258,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
image: public.ecr.aws/vanus/controller:5952928
image: public.ecr.aws/vanus/controller:v0.0.5
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
Expand Down Expand Up @@ -324,7 +324,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
image: public.ecr.aws/vanus/store:5952928
image: public.ecr.aws/vanus/store:v0.0.5
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
Expand Down
2 changes: 1 addition & 1 deletion internal/store/block/file/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (b *Block) loadIndexFromFile() error {
b.indexes = make([]index, num)
for i := range b.indexes {
off := int(length) - (i+1)*v1IndexSize
b.indexes[i], _ = unmashalIndex(data[off : off+v1IndexSize])
b.indexes[i], _ = unmarshalIndex(data[off : off+v1IndexSize])
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion internal/store/block/file/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (i index) MarshalTo(data []byte) (int, error) {
return v1IndexSize, nil
}

func unmashalIndex(data []byte) (index, error) {
func unmarshalIndex(data []byte) (index, error) {
if len(data) < v1IndexSize {
// TODO(james.yin): correct error.
return index{}, bytes.ErrTooLarge
Expand Down
37 changes: 37 additions & 0 deletions internal/store/block/file/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,40 @@
// limitations under the License.

package file

import (
"bytes"
. "github.com/smartystreets/goconvey/convey"
"math/rand"
"testing"
"time"
)

func TestIndex_Marshal(t *testing.T) {
Convey("test marshall & unmarshall of index", t, func() {
rd := rand.New(rand.NewSource(time.Now().UnixNano()))
idx1 := index{
offset: rd.Int63(),
length: rd.Int31(),
}

data := make([]byte, 12)
n, err := idx1.MarshalTo(data)
So(err, ShouldBeNil)
So(n, ShouldEqual, 12)

nIdx, err := unmarshalIndex(data)
So(err, ShouldBeNil)
So(idx1, ShouldResemble, nIdx)
So(nIdx.StartOffset(), ShouldEqual, nIdx.offset)
So(nIdx.EndOffset(), ShouldEqual, nIdx.offset+int64(nIdx.length))

n, err = idx1.MarshalTo(make([]byte, rd.Int31n(12)))
So(n, ShouldBeZeroValue)
So(err, ShouldEqual, bytes.ErrTooLarge)

nIdx, err = unmarshalIndex(make([]byte, rd.Int31n(12)))
So(n, ShouldBeZeroValue)
So(nIdx, ShouldResemble, index{})
})
}
126 changes: 0 additions & 126 deletions test/gateway/main.go

This file was deleted.

19 changes: 0 additions & 19 deletions test/standalone/main.go

This file was deleted.

48 changes: 0 additions & 48 deletions test/ut/mock_ut.go

This file was deleted.

30 changes: 0 additions & 30 deletions test/ut/ut.go

This file was deleted.

Loading

0 comments on commit c658ee8

Please sign in to comment.