Skip to content

Commit

Permalink
httpexec: fix broken unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
James DeFelice committed Sep 18, 2017
1 parent a269128 commit 5798ac9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/v1/lib/httpcli/httpexec/gen.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package httpexec

//go:generate go run ../../extras/gen/httpsender.go ../../extras/gen/gen.go -import github.com/mesos/mesos-go/api/v1/lib/executor -import github.com/mesos/mesos-go/api/v1/lib/executor/calls -type C:executor.Call:executor.Call{Type:agent.Call_MESSAGE}
//go:generate go run ../../extras/gen/httpsender.go ../../extras/gen/gen.go -import github.com/mesos/mesos-go/api/v1/lib/executor -import github.com/mesos/mesos-go/api/v1/lib/executor/calls -type C:executor.Call:executor.Call{Type:executor.Call_MESSAGE}
2 changes: 1 addition & 1 deletion api/v1/lib/httpcli/httpexec/httpexec_generated.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package httpexec

// go generate -import github.com/mesos/mesos-go/api/v1/lib/executor -import github.com/mesos/mesos-go/api/v1/lib/executor/calls -type C:executor.Call:executor.Call{Type:agent.Call_MESSAGE}
// go generate -import github.com/mesos/mesos-go/api/v1/lib/executor -import github.com/mesos/mesos-go/api/v1/lib/executor/calls -type C:executor.Call:executor.Call{Type:executor.Call_MESSAGE}
// GENERATED CODE FOLLOWS; DO NOT EDIT.

import (
Expand Down
4 changes: 2 additions & 2 deletions api/v1/lib/httpcli/httpexec/httpexec_generated_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package httpexec

// go generate -import github.com/mesos/mesos-go/api/v1/lib/executor -import github.com/mesos/mesos-go/api/v1/lib/executor/calls -type C:executor.Call:executor.Call{Type:agent.Call_MESSAGE}
// go generate -import github.com/mesos/mesos-go/api/v1/lib/executor -import github.com/mesos/mesos-go/api/v1/lib/executor/calls -type C:executor.Call:executor.Call{Type:executor.Call_MESSAGE}
// GENERATED CODE FOLLOWS; DO NOT EDIT.

import (
Expand Down Expand Up @@ -36,7 +36,7 @@ func TestNewSender(t *testing.T) {
return nil
}
sender := NewSender(cf)
c := &executor.Call{Type:agent.Call_MESSAGE}
c := &executor.Call{Type:executor.Call_MESSAGE}

check(sender.Send(context.Background(), calls.NonStreaming(c)))
r := sent()
Expand Down
11 changes: 9 additions & 2 deletions api/v1/lib/httpcli/httpexec/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ package httpexec
import (
"github.com/mesos/mesos-go/api/v1/lib/client"
"github.com/mesos/mesos-go/api/v1/lib/executor"
"github.com/mesos/mesos-go/api/v1/lib/httpcli"
)

func classifyResponse(c *executor.Call) (client.ResponseClass, error) {
return client.ResponseClassAuto, nil // TODO(jdef) fix this, ResponseClassAuto is deprecated
func classifyResponse(c *executor.Call) (rc client.ResponseClass, err error) {
switch name := executor.Call_Type_name[int32(c.GetType())]; name {
case "", "UNKNOWN":
err = httpcli.ProtocolError("unsupported call type")
default:
rc = client.ResponseClassAuto // TODO(jdef) fix this, ResponseClassAuto is deprecated
}
return
}

0 comments on commit 5798ac9

Please sign in to comment.