Skip to content

Commit

Permalink
Merge pull request #97 from abeaumont/feature/add-sdk-versioning
Browse files Browse the repository at this point in the history
Add SDK versioning support
  • Loading branch information
abeaumont authored Sep 7, 2017
2 parents 51eb19e + db3804d commit e29d536
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 87 deletions.
2 changes: 1 addition & 1 deletion cmd/bblfsh/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/bblfsh/server/runtime"

"github.com/Sirupsen/logrus"
"github.com/bblfsh/sdk/protocol"
"google.golang.org/grpc"
"gopkg.in/bblfsh/sdk.v0/protocol"
"srcd.works/go-errors.v0"
)

Expand Down
4 changes: 2 additions & 2 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/bblfsh/server/runtime"

"github.com/Sirupsen/logrus"
"github.com/bblfsh/sdk/protocol"
"github.com/bblfsh/sdk/protocol/driver"
"gopkg.in/bblfsh/sdk.v0/protocol"
"gopkg.in/bblfsh/sdk.v0/protocol/driver"
)

// Driver is a client to communicate with a driver. It provides the parser
Expand Down
69 changes: 35 additions & 34 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ package: github.com/bblfsh/server
import:
- package: github.com/Sirupsen/logrus
version: ^1.0.2
- package: github.com/bblfsh/sdk
version: 1359c9931edf588eb90360a21dc693225ca08e0e
subpackages:
- manifest
- protocol
- protocol/driver
- package: github.com/containers/image
version: 66efd5c31ce9470c37d8fb40c2e424c63f72c735
subpackages:
Expand Down Expand Up @@ -42,6 +36,8 @@ import:
version: ^1.1.0
- package: google.golang.org/grpc
version: ^1.4.2
- package: gopkg.in/bblfsh/sdk.v0
version: ^0.2.1
- package: gopkg.in/src-d/enry.v1
version: ^1.3.0
- package: gopkg.in/src-d/go-errors.v0
Expand Down
2 changes: 1 addition & 1 deletion pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"sync/atomic"
"time"

"github.com/bblfsh/sdk/protocol"
"github.com/pkg/errors"
"gopkg.in/bblfsh/sdk.v0/protocol"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"testing"
"time"

"github.com/bblfsh/sdk/protocol"
"github.com/stretchr/testify/require"
"gopkg.in/bblfsh/sdk.v0/protocol"
)

type mockDriver struct {
Expand Down
2 changes: 1 addition & 1 deletion runtime/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"path/filepath"
"testing"

"github.com/bblfsh/sdk/manifest"
"github.com/containers/image/types"
"gopkg.in/bblfsh/sdk.v0/manifest"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion runtime/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"path/filepath"

"github.com/bblfsh/sdk/manifest"
"gopkg.in/bblfsh/sdk.v0/manifest"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion runtime/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"
"testing"

"github.com/bblfsh/sdk/manifest"
"github.com/stretchr/testify/require"
"gopkg.in/bblfsh/sdk.v0/manifest"
)

func TestStorageInstall(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"sync"

"github.com/bblfsh/server/runtime"
"github.com/bblfsh/sdk/uast"

"github.com/Sirupsen/logrus"
"github.com/bblfsh/sdk/protocol"
"google.golang.org/grpc"
"gopkg.in/bblfsh/sdk.v0/protocol"
"gopkg.in/bblfsh/sdk.v0/uast"
"gopkg.in/src-d/go-errors.v0"
)

Expand Down
39 changes: 2 additions & 37 deletions server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import (

"github.com/bblfsh/server/runtime"

"github.com/bblfsh/sdk/protocol"
"github.com/bblfsh/sdk/uast"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"gopkg.in/bblfsh/sdk.v0/protocol"
"gopkg.in/bblfsh/sdk.v0/uast"
)

type echoDriver struct{}
Expand Down Expand Up @@ -152,41 +152,6 @@ func TestMaxMessageSizeExceeded(t *testing.T) {
require.NoError(err)
}

func TestMaxMessageSizeExceededInClient(t *testing.T) {
require := require.New(t)
tmpDir, err := ioutil.TempDir(os.TempDir(), "bblfsh-runtime")
r := runtime.NewRuntime(tmpDir)
err = r.Init()
require.NoError(err)

s := NewServer("", r, make(map[string]string))
dp, err := StartDriverPool(DefaultScalingPolicy(), DefaultPoolTimeout, func() (Driver, error) {
return &echoDriver{}, nil
})
require.NoError(err)
require.NotNil(dp)

s.drivers["python"] = dp

lis, err := net.Listen("tcp", "localhost:0")
require.NoError(err)
go s.Serve(lis, 8*1024*1024)

time.Sleep(time.Second * 1)

conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure(), grpc.WithTimeout(time.Second*2))
require.NoError(err)
client := protocol.NewProtocolServiceClient(conn)
_, err = client.Parse(context.TODO(), &protocol.ParseRequest{Content: bigContent()})
require.NotNil(err)
status, _ := status.FromError(err)
require.Equal(status.Code(), codes.ResourceExhausted)
err = conn.Close()
require.NoError(err)
err = s.Close()
require.NoError(err)
}

func TestMaxMessageSizeExceededInServer(t *testing.T) {
require := require.New(t)
tmpDir, err := ioutil.TempDir(os.TempDir(), "bblfsh-runtime")
Expand Down

0 comments on commit e29d536

Please sign in to comment.