Skip to content

Commit

Permalink
A few more tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Campbell <ijc@docker.com>
  • Loading branch information
Ian Campbell committed Aug 8, 2018
1 parent 94e9ccc commit f1e28db
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions client/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (

"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/frontend/gateway/client"
gatewayapi "github.com/moby/buildkit/frontend/gateway/pb"
"github.com/moby/buildkit/identity"
"github.com/moby/buildkit/util/testutil/integration"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
Expand All @@ -19,6 +21,8 @@ func TestClientGatewayIntegration(t *testing.T) {
testClientGatewaySolve,
testClientGatewayFailedSolve,
testClientGatewayEmptySolve,
testNoBuildID,
testUnknownBuildID,
})
}

Expand Down Expand Up @@ -140,3 +144,35 @@ func testClientGatewayEmptySolve(t *testing.T, sb integration.Sandbox) {
_, err = c.Build(ctx, SolveOpt{}, "", b, nil)
require.NoError(t, err)
}

func testNoBuildID(t *testing.T, sb integration.Sandbox) {
t.Parallel()
requiresLinux(t)

ctx := context.TODO()

c, err := New(ctx, sb.Address())
require.NoError(t, err)
defer c.Close()

g := gatewayapi.NewLLBBridgeClient(c.conn)
_, err = g.Ping(ctx, &gatewayapi.PingRequest{})
require.Error(t, err)
require.Contains(t, err.Error(), "no buildid found in context")
}

func testUnknownBuildID(t *testing.T, sb integration.Sandbox) {
t.Parallel()
requiresLinux(t)

ctx := context.TODO()

c, err := New(ctx, sb.Address())
require.NoError(t, err)
defer c.Close()

g := c.gatewayClientForBuild(t.Name() + identity.NewID())
_, err = g.Ping(ctx, &gatewayapi.PingRequest{})
require.Error(t, err)
require.Contains(t, err.Error(), "no such job")
}

0 comments on commit f1e28db

Please sign in to comment.