Skip to content

Commit 9033dd4

Browse files
leecalcotekumarabd
authored andcommitted
added grpc and docker for smi-conformance
Signed-off-by: kumarabd <abishekkumar92@gmail.com>
2 parents 222c035 + fa3b810 commit 9033dd4

3,009 files changed

Lines changed: 1107103 additions & 90 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,17 @@ curl --location --request DELETE 'http://34.68.35.174:9091/metrics'
110110
> Note: metrics are collected only for `/call` and `/echo`.
111111
112112
# Service Mesh Interface (SMI) Conformance
113-
The `learn-layer5` application serves as a sample application to validate the conformance of any service mesh with the SMI specifications. To verfiy SMI conformance, run Meshery and invoke the suite of SMI tests specific to the service mesh you would like to validate.
113+
The `learn-layer5` application serves as a sample application to validate the conformance of any service mesh with the SMI specifications. To verify SMI conformance, run Meshery and invoke the suite of SMI tests specific to the service mesh you would like to validate.
114114

115115
## Testing with Meshery
116-
Meshery allows you to sechedule tests and invoke them programmatically. Meshery will store these test results and allow you to retrieve them later.
116+
Meshery allows you to schedule tests and invoke them programmatically. Meshery will store these test results and allow you to retrieve them later.
117117

118118
## Testing Manually
119119

120120
To manually invoke SMI Conformance test for a deployed service mesh, you can apply tests from the `smi-test` directory of this repository. Execute the following command to run the smi-conformace tests:
121121

122122
# To check for smi conformance of a deployed service mesh
123-
We use kuttl to check for SMI conformance. All the tests are writtten in smi-test directory of this repository.
123+
We use kuttl to check for SMI conformance. All the tests are written in smi-test directory of this repository.
124124
Execute the following command in `./smi-conformance` to run the smi-conformace tests:-
125125

126126
```shell

smi-conformance/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM golang:1.14-alpine3.11 as build-img
2+
LABEL maintainer "Layer5.io"
3+
4+
ENV GO111MODULE=off
5+
6+
RUN apk update && apk add --no-cache git libc-dev gcc pkgconf && mkdir /home/meshery
7+
COPY ${PWD} /go/src/github.com/layer5io/learn-layer5/smi-conformance/
8+
WORKDIR /go/src/github.com/layer5io/learn-layer5/smi-conformance/
9+
# RUN git rev-parse HEAD > /home/meshery/version
10+
# RUN git describe --tags `git rev-list --tags --max-count=1` >> /home/com/version
11+
12+
RUN go build -a -ldflags "-s -w" -o /home/meshery/smi_conformance main.go
13+
14+
FROM registry.bookmyshow.org/alpine:latest
15+
16+
RUN apk --no-cache add ca-certificates
17+
COPY --from=build-img /home/meshery/** /home/
18+
WORKDIR /home/
19+
EXPOSE 10008
20+
CMD ["sh","-c","./smi_conformance"]
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package conformance
2+
3+
import (
4+
context "context"
5+
6+
"github.com/sirupsen/logrus"
7+
"google.golang.org/grpc"
8+
)
9+
10+
// ConformanceClient represents a gRPC adapter client
11+
type ConformanceClient struct {
12+
CClient ConformanceTestingClient
13+
conn *grpc.ClientConn
14+
}
15+
16+
// CreateClient creates a ConformanceClient for the given params
17+
func CreateClient(ctx context.Context, conformanceLocationURL string) (*ConformanceClient, error) {
18+
var opts []grpc.DialOption
19+
// creds, err := credentials.NewClientTLSFromFile(*caFile, *serverHostOverride)
20+
// if err != nil {
21+
// logrus.Errorf("Failed to create TLS credentials %v", err)
22+
// }
23+
// opts = append(opts, grpc.WithTransportCredentials(creds))
24+
// } else {
25+
opts = append(opts, grpc.WithInsecure())
26+
// }
27+
conn, err := grpc.Dial(conformanceLocationURL, opts...)
28+
if err != nil {
29+
logrus.Errorf("fail to dial: %v", err)
30+
}
31+
32+
cClient := NewConformanceTestingClient(conn)
33+
34+
return &ConformanceClient{
35+
conn: conn,
36+
CClient: cClient,
37+
}, nil
38+
}
39+
40+
// Close closes the ConformanceClient
41+
func (c *ConformanceClient) Close() error {
42+
if c.conn != nil {
43+
return c.conn.Close()
44+
}
45+
return nil
46+
}

0 commit comments

Comments
 (0)