From 9cd6b356bfbc3c306e6720179d703c8e3c58bcf6 Mon Sep 17 00:00:00 2001 From: Janos Dobronszki Date: Thu, 15 Oct 2020 16:59:45 +0200 Subject: [PATCH] Removing tests folder --- .github/workflows/integration-blog.yml | 2 +- {tests => test}/integration/README.md | 0 {tests => test}/integration/blog/blog_test.go | 0 tests/README.md | 11 -- tests/handler/handler.go | 14 -- tests/image/.dockerignore | 4 - tests/image/Dockerfile | 32 --- tests/image/run-etcd.sh | 8 - tests/image/test-docker.sh | 5 - tests/main.go | 19 -- tests/proto/tests.pb.go | 184 ------------------ tests/proto/tests.pb.micro.go | 95 --------- tests/proto/tests.proto | 26 --- 13 files changed, 1 insertion(+), 399 deletions(-) rename {tests => test}/integration/README.md (100%) rename {tests => test}/integration/blog/blog_test.go (100%) delete mode 100644 tests/README.md delete mode 100644 tests/handler/handler.go delete mode 100644 tests/image/.dockerignore delete mode 100644 tests/image/Dockerfile delete mode 100644 tests/image/run-etcd.sh delete mode 100755 tests/image/test-docker.sh delete mode 100644 tests/main.go delete mode 100644 tests/proto/tests.pb.go delete mode 100644 tests/proto/tests.pb.micro.go delete mode 100644 tests/proto/tests.proto diff --git a/.github/workflows/integration-blog.yml b/.github/workflows/integration-blog.yml index 493929e..b356250 100644 --- a/.github/workflows/integration-blog.yml +++ b/.github/workflows/integration-blog.yml @@ -50,7 +50,7 @@ jobs: bash services/tests/image/test-docker.sh - name: Test Blog services - working-directory: services/tests + working-directory: services/test/integration run: | go clean -testcache && GOMAXPROCS=4 go test -timeout 15m --tags=blog -v ./... diff --git a/tests/integration/README.md b/test/integration/README.md similarity index 100% rename from tests/integration/README.md rename to test/integration/README.md diff --git a/tests/integration/blog/blog_test.go b/test/integration/blog/blog_test.go similarity index 100% rename from tests/integration/blog/blog_test.go rename to test/integration/blog/blog_test.go diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index ec051b9..0000000 --- a/tests/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Tests Service - -The tests service is for end to end testing - -## Overview - -This is a future service for end to end testing which either comes pre-built with integration tests in the -integration sub directory or with tests which are register via an endpoint Tests.Register for a callback -which then conforms to our testing API. - - diff --git a/tests/handler/handler.go b/tests/handler/handler.go deleted file mode 100644 index 8932073..0000000 --- a/tests/handler/handler.go +++ /dev/null @@ -1,14 +0,0 @@ -package handler - -import ( - "context" - - pb "github.com/m3o/services/tests/proto" -) - -type Tests struct{} - -func (t *Tests) Register(ctx context.Context, req *pb.RegisterRequest, rsp *pb.RegisterResponse) error { - // TODO register the test to be run periodically - return nil -} diff --git a/tests/image/.dockerignore b/tests/image/.dockerignore deleted file mode 100644 index f1618a6..0000000 --- a/tests/image/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -**/Dockerfile -**/*.md -**/*.git -**/*.dockerignore \ No newline at end of file diff --git a/tests/image/Dockerfile b/tests/image/Dockerfile deleted file mode 100644 index ad91e5c..0000000 --- a/tests/image/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM alpine:latest -RUN apk add make git go gcc libtool musl-dev curl bash - -# Configure Go -ENV GOROOT /usr/lib/go -ENV GOPATH /go -ENV PATH /go/bin:$PATH - -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin - -RUN apk add ca-certificates && \ - rm -rf /var/cache/apk/* /tmp/* && \ - [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf - -RUN apk add --update ca-certificates openssl tar && \ - wget https://github.com/coreos/etcd/releases/download/v3.4.7/etcd-v3.4.7-linux-amd64.tar.gz && \ - tar xzvf etcd-v3.4.7-linux-amd64.tar.gz && \ - mv etcd-v3.4.7-linux-amd64/etcd* /bin/ && \ - apk del --purge tar openssl && \ - rm -Rf etcd-v3.4.7-linux-amd64* /var/cache/apk/* -VOLUME /data -EXPOSE 2379 2380 4001 7001 -ADD services/tests/image/run-etcd.sh /bin/run.sh - -# Speeding up tests by predownloading and building dependencies for services used. -RUN mkdir services -COPY services/go.* services/ -RUN cd services && go mod download -COPY services/ services -RUN bash -c 'for d in $(find services -name "main.go" | xargs -n 1 dirname); do pushd $d && go install && popd; done' -COPY ./micro/micro /microserver -ENTRYPOINT ["sh", "/bin/run.sh"] diff --git a/tests/image/run-etcd.sh b/tests/image/run-etcd.sh deleted file mode 100644 index 88aa675..0000000 --- a/tests/image/run-etcd.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -ETCD_CMD="/bin/etcd -data-dir=/data" -echo -e "Running '$ETCD_CMD'\nBEGIN ETCD OUTPUT\n" - -exec $ETCD_CMD & -sleep 4 -/microserver $* diff --git a/tests/image/test-docker.sh b/tests/image/test-docker.sh deleted file mode 100755 index ecb83a9..0000000 --- a/tests/image/test-docker.sh +++ /dev/null @@ -1,5 +0,0 @@ -cp services/tests/image/.dockerignore . -pushd micro -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -popd -DOCKER_BUILDKIT=1 docker build -t micro -f services/tests/image/Dockerfile . diff --git a/tests/main.go b/tests/main.go deleted file mode 100644 index 76be2b0..0000000 --- a/tests/main.go +++ /dev/null @@ -1,19 +0,0 @@ -package main - -import ( - "github.com/m3o/services/tests/handler" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/micro/v3/service" -) - -func main() { - service := service.New( - service.Name("tests"), - ) - - service.Handle(new(handler.Tests)) - - if err := service.Run(); err != nil { - logger.Fatal(err) - } -} diff --git a/tests/proto/tests.pb.go b/tests/proto/tests.pb.go deleted file mode 100644 index 3e82699..0000000 --- a/tests/proto/tests.pb.go +++ /dev/null @@ -1,184 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: tests/proto/tests.proto - -package go_micro_service_tests - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type Test struct { - // name of the test - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // service to call back - Service string `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"` - // endpoint to call back - Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"` - // how often to run the test in seconds - Interval int64 `protobuf:"varint,4,opt,name=interval,proto3" json:"interval,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Test) Reset() { *m = Test{} } -func (m *Test) String() string { return proto.CompactTextString(m) } -func (*Test) ProtoMessage() {} -func (*Test) Descriptor() ([]byte, []int) { - return fileDescriptor_8daabec0b76982a6, []int{0} -} - -func (m *Test) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Test.Unmarshal(m, b) -} -func (m *Test) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Test.Marshal(b, m, deterministic) -} -func (m *Test) XXX_Merge(src proto.Message) { - xxx_messageInfo_Test.Merge(m, src) -} -func (m *Test) XXX_Size() int { - return xxx_messageInfo_Test.Size(m) -} -func (m *Test) XXX_DiscardUnknown() { - xxx_messageInfo_Test.DiscardUnknown(m) -} - -var xxx_messageInfo_Test proto.InternalMessageInfo - -func (m *Test) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Test) GetService() string { - if m != nil { - return m.Service - } - return "" -} - -func (m *Test) GetEndpoint() string { - if m != nil { - return m.Endpoint - } - return "" -} - -func (m *Test) GetInterval() int64 { - if m != nil { - return m.Interval - } - return 0 -} - -type RegisterRequest struct { - Tests []*Test `protobuf:"bytes,1,rep,name=tests,proto3" json:"tests,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RegisterRequest) Reset() { *m = RegisterRequest{} } -func (m *RegisterRequest) String() string { return proto.CompactTextString(m) } -func (*RegisterRequest) ProtoMessage() {} -func (*RegisterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8daabec0b76982a6, []int{1} -} - -func (m *RegisterRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RegisterRequest.Unmarshal(m, b) -} -func (m *RegisterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RegisterRequest.Marshal(b, m, deterministic) -} -func (m *RegisterRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_RegisterRequest.Merge(m, src) -} -func (m *RegisterRequest) XXX_Size() int { - return xxx_messageInfo_RegisterRequest.Size(m) -} -func (m *RegisterRequest) XXX_DiscardUnknown() { - xxx_messageInfo_RegisterRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_RegisterRequest proto.InternalMessageInfo - -func (m *RegisterRequest) GetTests() []*Test { - if m != nil { - return m.Tests - } - return nil -} - -type RegisterResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RegisterResponse) Reset() { *m = RegisterResponse{} } -func (m *RegisterResponse) String() string { return proto.CompactTextString(m) } -func (*RegisterResponse) ProtoMessage() {} -func (*RegisterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8daabec0b76982a6, []int{2} -} - -func (m *RegisterResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RegisterResponse.Unmarshal(m, b) -} -func (m *RegisterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RegisterResponse.Marshal(b, m, deterministic) -} -func (m *RegisterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RegisterResponse.Merge(m, src) -} -func (m *RegisterResponse) XXX_Size() int { - return xxx_messageInfo_RegisterResponse.Size(m) -} -func (m *RegisterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RegisterResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RegisterResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Test)(nil), "go.micro.service.tests.Test") - proto.RegisterType((*RegisterRequest)(nil), "go.micro.service.tests.RegisterRequest") - proto.RegisterType((*RegisterResponse)(nil), "go.micro.service.tests.RegisterResponse") -} - -func init() { proto.RegisterFile("tests/proto/tests.proto", fileDescriptor_8daabec0b76982a6) } - -var fileDescriptor_8daabec0b76982a6 = []byte{ - // 217 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x41, 0x4b, 0x03, 0x31, - 0x10, 0x85, 0x8d, 0xbb, 0xd5, 0x3a, 0x1e, 0x94, 0x39, 0x68, 0x28, 0x1e, 0x96, 0x5c, 0xcc, 0x29, - 0x85, 0xf5, 0x37, 0xf8, 0x07, 0x82, 0x77, 0xa9, 0x75, 0xa8, 0x81, 0x36, 0x59, 0x33, 0xb1, 0xbf, - 0x5f, 0x32, 0xeb, 0xae, 0x20, 0x8a, 0xb7, 0xf7, 0xf2, 0x1e, 0xf3, 0x3e, 0x02, 0xb7, 0x85, 0xb8, - 0xf0, 0x7a, 0xc8, 0xa9, 0xa4, 0xb5, 0x68, 0x27, 0x1a, 0x6f, 0x76, 0xc9, 0x1d, 0xc2, 0x36, 0x27, - 0xc7, 0x94, 0x8f, 0x61, 0x4b, 0x4e, 0x52, 0xb3, 0x87, 0xf6, 0x89, 0xb8, 0x20, 0x42, 0x1b, 0x37, - 0x07, 0xd2, 0xaa, 0x53, 0xf6, 0xc2, 0x8b, 0x46, 0x0d, 0xe7, 0x5f, 0x65, 0x7d, 0x2a, 0xcf, 0x93, - 0xc5, 0x15, 0x2c, 0x29, 0xbe, 0x0e, 0x29, 0xc4, 0xa2, 0x1b, 0x89, 0x66, 0x5f, 0xb3, 0x10, 0x0b, - 0xe5, 0xe3, 0x66, 0xaf, 0xdb, 0x4e, 0xd9, 0xc6, 0xcf, 0xde, 0x3c, 0xc2, 0x95, 0xa7, 0x5d, 0xe0, - 0x42, 0xd9, 0xd3, 0xfb, 0x47, 0x1d, 0xee, 0x61, 0x21, 0x24, 0x5a, 0x75, 0x8d, 0xbd, 0xec, 0xef, - 0xdc, 0xef, 0xa0, 0xae, 0x52, 0xfa, 0xb1, 0x6a, 0x10, 0xae, 0xbf, 0xcf, 0xf0, 0x90, 0x22, 0x53, - 0xff, 0x06, 0x8b, 0x5a, 0x61, 0x7c, 0x86, 0xe5, 0x14, 0xe2, 0xfd, 0x5f, 0xd7, 0x7e, 0x50, 0xac, - 0xec, 0xff, 0xc5, 0x71, 0xc7, 0x9c, 0xbc, 0x9c, 0xc9, 0x8f, 0x3e, 0x7c, 0x06, 0x00, 0x00, 0xff, - 0xff, 0x2d, 0xa4, 0xe4, 0x69, 0x6c, 0x01, 0x00, 0x00, -} diff --git a/tests/proto/tests.pb.micro.go b/tests/proto/tests.pb.micro.go deleted file mode 100644 index 87107a4..0000000 --- a/tests/proto/tests.pb.micro.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by protoc-gen-micro. DO NOT EDIT. -// source: tests/proto/tests.proto - -package go_micro_service_tests - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -import ( - context "context" - api "github.com/micro/go-micro/v3/api" - client "github.com/micro/go-micro/v3/client" - server "github.com/micro/go-micro/v3/server" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// Reference imports to suppress errors if they are not otherwise used. -var _ api.Endpoint -var _ context.Context -var _ client.Option -var _ server.Option - -// Api Endpoints for Tests service - -func NewTestsEndpoints() []*api.Endpoint { - return []*api.Endpoint{} -} - -// Client API for Tests service - -type TestsService interface { - // enables registering an endpoint for callback to run tests - Register(ctx context.Context, in *RegisterRequest, opts ...client.CallOption) (*RegisterResponse, error) -} - -type testsService struct { - c client.Client - name string -} - -func NewTestsService(name string, c client.Client) TestsService { - return &testsService{ - c: c, - name: name, - } -} - -func (c *testsService) Register(ctx context.Context, in *RegisterRequest, opts ...client.CallOption) (*RegisterResponse, error) { - req := c.c.NewRequest(c.name, "Tests.Register", in) - out := new(RegisterResponse) - err := c.c.Call(ctx, req, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for Tests service - -type TestsHandler interface { - // enables registering an endpoint for callback to run tests - Register(context.Context, *RegisterRequest, *RegisterResponse) error -} - -func RegisterTestsHandler(s server.Server, hdlr TestsHandler, opts ...server.HandlerOption) error { - type tests interface { - Register(ctx context.Context, in *RegisterRequest, out *RegisterResponse) error - } - type Tests struct { - tests - } - h := &testsHandler{hdlr} - return s.Handle(s.NewHandler(&Tests{h}, opts...)) -} - -type testsHandler struct { - TestsHandler -} - -func (h *testsHandler) Register(ctx context.Context, in *RegisterRequest, out *RegisterResponse) error { - return h.TestsHandler.Register(ctx, in, out) -} diff --git a/tests/proto/tests.proto b/tests/proto/tests.proto deleted file mode 100644 index 4370703..0000000 --- a/tests/proto/tests.proto +++ /dev/null @@ -1,26 +0,0 @@ -syntax = "proto3"; - -package go.micro.service.tests; - -service Tests { - // enables registering an endpoint for callback to run tests - rpc Register(RegisterRequest) returns (RegisterResponse) {}; -} - -message Test { - // name of the test - string name = 1; - // service to call back - string service = 2; - // endpoint to call back - string endpoint = 3; - // how often to run the test in seconds - int64 interval = 4; - // TODO: data to include in the callback -} - -message RegisterRequest { - repeated Test tests = 1; -} - -message RegisterResponse {}