From 2182e790ce0308d9d08bc9b1ef11514d562511dc Mon Sep 17 00:00:00 2001 From: Adam Ryman Date: Fri, 28 Oct 2016 17:10:18 -0700 Subject: [PATCH] Rename http integration tests to transport --- truss/_integration-tests/Makefile | 16 ++++++++-------- .../{http => transport}/Makefile | 11 +++++------ .../handlers/server/server_handler.go | 14 +++++++------- .../{http => transport}/http_test.go | 11 ++++------- .../transport-test.proto} | 4 ++-- 5 files changed, 26 insertions(+), 30 deletions(-) rename truss/_integration-tests/{http => transport}/Makefile (72%) rename truss/_integration-tests/{http => transport}/handlers/server/server_handler.go (69%) rename truss/_integration-tests/{http => transport}/http_test.go (95%) rename truss/_integration-tests/{http/httptest.proto => transport/transport-test.proto} (96%) diff --git a/truss/_integration-tests/Makefile b/truss/_integration-tests/Makefile index e5bfe8c..382dce3 100644 --- a/truss/_integration-tests/Makefile +++ b/truss/_integration-tests/Makefile @@ -3,24 +3,24 @@ OK_COLOR=\e[38;5;118m UNDER=\n________________________________________________________________________________\n END_COLOR_LINE=$(UNDER)$(NO_COLOR) -HTTPTEST_MSG=\n$(OK_COLOR)Starting http end to end test:$(END_COLOR_LINE) +TRANSPORT_TEST_MSG=\n$(OK_COLOR)Starting transport end to end test:$(END_COLOR_LINE) -CLITEST_MSG=\n$(OK_COLOR)Start server and cliclient generate, build, and run test:$(END_COLOR_LINE) +CLI_TEST_MSG=\n$(OK_COLOR)Start server and cliclient generate, build, and run test:$(END_COLOR_LINE) all: test -test: clean test-http test-cli +test: clean test-transport test-cli -test-http: - @printf '$(HTTPTEST_MSG)' - $(MAKE) -C http +test-transport: + @printf '$(TRANSPORT_TEST_MSG)' + $(MAKE) -C transport test-cli: - @printf '$(CLITEST_MSG)' + @printf '$(CLI_TEST_MSG)' go test -v ./cli clean: go test ./cli -clean - $(MAKE) -C http clean + $(MAKE) -C transport clean diff --git a/truss/_integration-tests/http/Makefile b/truss/_integration-tests/transport/Makefile similarity index 72% rename from truss/_integration-tests/http/Makefile rename to truss/_integration-tests/transport/Makefile index c9f6964..495ba5d 100644 --- a/truss/_integration-tests/http/Makefile +++ b/truss/_integration-tests/transport/Makefile @@ -5,7 +5,7 @@ END_COLOR_LINE=$(UNDER)$(NO_COLOR) TRUSS_MSG=\n$(OK_COLOR)Running Truss...$(END_COLOR_LINE) -TEST_RUNNING_MSG=\n$(OK_COLOR)Running http tests:$(END_COLOR_LINE) +TEST_RUNNING_MSG=\n$(OK_COLOR)Running transport tests:$(END_COLOR_LINE) TRUSS_AGAIN_MSG=\n$(OK_COLOR)Running Truss... again, to test regeneration$(END_COLOR_LINE) @@ -13,16 +13,15 @@ all: test test: @echo -e '$(TRUSS_MSG)' - truss httptest.proto - cp -r handlers httptest-service + truss transport-test.proto + cp -r handlers transport-service @echo -e '$(TEST_RUNNING_MSG)' go test -v @echo -e '$(TRUSS_AGAIN_MSG)' - truss httptest.proto + truss transport-test.proto @echo -e '$(TEST_RUNNING_MSG)' go test -v $(MAKE) clean clean: - rm -rf httptest-service - rm -rf third_party + rm -rf transport-service diff --git a/truss/_integration-tests/http/handlers/server/server_handler.go b/truss/_integration-tests/transport/handlers/server/server_handler.go similarity index 69% rename from truss/_integration-tests/http/handlers/server/server_handler.go rename to truss/_integration-tests/transport/handlers/server/server_handler.go index c6ebf1f..d48afce 100644 --- a/truss/_integration-tests/http/handlers/server/server_handler.go +++ b/truss/_integration-tests/transport/handlers/server/server_handler.go @@ -12,18 +12,18 @@ import ( _ "github.com/go-kit/kit/log" _ "github.com/go-kit/kit/metrics" - pb "github.com/TuneLab/go-truss/truss/_integration-tests/http/httptest-service" + pb "github.com/TuneLab/go-truss/truss/_integration-tests/transport/transport-service" ) // NewService returns a naïve, stateless implementation of Service. func NewService() Service { - return httptestService{} + return transportService{} } -type httptestService struct{} +type transportService struct{} // GetWithQuery implements Service. -func (s httptestService) GetWithQuery(ctx context.Context, in *pb.GetWithQueryRequest) (*pb.GetWithQueryResponse, error) { +func (s transportService) GetWithQuery(ctx context.Context, in *pb.GetWithQueryRequest) (*pb.GetWithQueryResponse, error) { response := pb.GetWithQueryResponse{ V: in.A + in.B, } @@ -32,7 +32,7 @@ func (s httptestService) GetWithQuery(ctx context.Context, in *pb.GetWithQueryRe } // GetWithRepeatedQuery implements Service. -func (s httptestService) GetWithRepeatedQuery(ctx context.Context, in *pb.GetWithRepeatedQueryRequest) (*pb.GetWithRepeatedQueryResponse, error) { +func (s transportService) GetWithRepeatedQuery(ctx context.Context, in *pb.GetWithRepeatedQueryRequest) (*pb.GetWithRepeatedQueryResponse, error) { var out int64 for _, v := range in.A { @@ -47,7 +47,7 @@ func (s httptestService) GetWithRepeatedQuery(ctx context.Context, in *pb.GetWit } // PostWithNestedMessageBody implements Service. -func (s httptestService) PostWithNestedMessageBody(ctx context.Context, in *pb.PostWithNestedMessageBodyRequest) (*pb.PostWithNestedMessageBodyResponse, error) { +func (s transportService) PostWithNestedMessageBody(ctx context.Context, in *pb.PostWithNestedMessageBodyRequest) (*pb.PostWithNestedMessageBodyResponse, error) { response := pb.PostWithNestedMessageBodyResponse{ V: in.NM.A + in.NM.B, } @@ -55,7 +55,7 @@ func (s httptestService) PostWithNestedMessageBody(ctx context.Context, in *pb.P } // CtxtToCtxtViaHTTPHeader implements Service. -func (s httptestService) CtxToCtxViaHTTPHeader(ctx context.Context, in *pb.HeaderRequest) (*pb.HeaderResponse, error) { +func (s transportService) CtxToCtxViaHTTPHeader(ctx context.Context, in *pb.HeaderRequest) (*pb.HeaderResponse, error) { var resp pb.HeaderResponse val := ctx.Value(in.HeaderKey) diff --git a/truss/_integration-tests/http/http_test.go b/truss/_integration-tests/transport/http_test.go similarity index 95% rename from truss/_integration-tests/http/http_test.go rename to truss/_integration-tests/transport/http_test.go index 7c7c944..717294c 100644 --- a/truss/_integration-tests/http/http_test.go +++ b/truss/_integration-tests/transport/http_test.go @@ -6,7 +6,6 @@ import ( "bytes" "encoding/json" "fmt" - "io" "io/ioutil" "net/http" "net/http/httptest" @@ -19,18 +18,16 @@ import ( "github.com/go-kit/kit/log" // This Service - pb "github.com/TuneLab/go-truss/truss/_integration-tests/http/httptest-service" - svc "github.com/TuneLab/go-truss/truss/_integration-tests/http/httptest-service/generated" - httpclient "github.com/TuneLab/go-truss/truss/_integration-tests/http/httptest-service/generated/client/http" - handler "github.com/TuneLab/go-truss/truss/_integration-tests/http/httptest-service/handlers/server" + pb "github.com/TuneLab/go-truss/truss/_integration-tests/transport/transport-service" + svc "github.com/TuneLab/go-truss/truss/_integration-tests/transport/transport-service/generated" + httpclient "github.com/TuneLab/go-truss/truss/_integration-tests/transport/transport-service/generated/client/http" + handler "github.com/TuneLab/go-truss/truss/_integration-tests/transport/transport-service/handlers/server" "github.com/pkg/errors" ) var httpserver *httptest.Server -var _ = io.Copy - func init() { var logger log.Logger logger = log.NewNopLogger() diff --git a/truss/_integration-tests/http/httptest.proto b/truss/_integration-tests/transport/transport-test.proto similarity index 96% rename from truss/_integration-tests/http/httptest.proto rename to truss/_integration-tests/transport/transport-test.proto index 356c584..c0ffe65 100644 --- a/truss/_integration-tests/http/httptest.proto +++ b/truss/_integration-tests/transport/transport-test.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package httptest; +package transport; import "google/api/annotations.proto"; -service HTTPPermutations { +service TransportPermutations { rpc GetWithQuery (GetWithQueryRequest) returns (GetWithQueryResponse) { option (google.api.http) = { get: "/getwithquery"