Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasMahe committed Mar 8, 2019
1 parent 084103d commit 592df59
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions interface/grpc/core/deploy_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ func TestIntegrationDeployService(t *testing.T) {
stream := newTestDeployStream(url)

require.Nil(t, server.DeployService(stream))
defer server.api.DeleteService(stream.serviceID, false)
defer server.api.DeleteService(stream.sid, false)

require.Len(t, stream.serviceID, 7)
require.Len(t, stream.sid, 7)
require.NotEmpty(t, stream.hash)
require.Contains(t, stream.statuses, api.DeployStatus{
Message: "Image built with success",
Type: api.DonePositive,
Expand Down
15 changes: 9 additions & 6 deletions interface/grpc/core/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ func TestDeployService(t *testing.T) {

stream := newTestDeployStream(url)
require.Nil(t, server.DeployService(stream))
require.Len(t, stream.serviceID, 7)
require.Len(t, stream.sid, 7)
require.NotEmpty(t, stream.hash)

require.Contains(t, stream.statuses, api.DeployStatus{
Message: "Image built with success",
Expand All @@ -30,10 +31,11 @@ func TestDeployService(t *testing.T) {

// TODO(ilgooz) also add tests for receiving chunks.
type testDeployStream struct {
url string // Git repo url.
err error
serviceID string
statuses []api.DeployStatus
url string // Git repo url.
err error
sid string
hash string
statuses []api.DeployStatus
grpc.ServerStream
}

Expand All @@ -42,7 +44,8 @@ func newTestDeployStream(url string) *testDeployStream {
}

func (s *testDeployStream) Send(m *coreapi.DeployServiceReply) error {
s.serviceID = m.GetServiceID()
s.sid = m.GetService().GetSid()
s.hash = m.GetService().GetHash()

status := m.GetStatus()
if status != nil {
Expand Down
2 changes: 1 addition & 1 deletion interface/grpc/core/list_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestListServices(t *testing.T) {

stream := newTestDeployStream(url)
require.NoError(t, server.DeployService(stream))
defer server.api.DeleteService(stream.serviceID, false)
defer server.api.DeleteService(stream.sid, false)

reply, err := server.ListServices(context.Background(), &coreapi.ListServicesRequest{})
require.NoError(t, err)
Expand Down

0 comments on commit 592df59

Please sign in to comment.