Skip to content

Commit 989320d

Browse files
committed
Merge branch 'master' of https://github.com/layer5io/learn-layer5 into addLabels
Signed-off-by: Naveen Jain <nveenjain@gmail.com>
2 parents 04bec6d + 4ac3201 commit 989320d

File tree

3 files changed

+82
-47
lines changed

3 files changed

+82
-47
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,16 @@ 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 verify 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 the Meshery adapter for the specific service mesh you wish to test. Invoke the suite of SMI conformance tests on the specific service mesh you would like to validate.
114114

115-
## Testing with Meshery
116-
Meshery allows you to schedule tests and invoke them programmatically. Meshery will store these test results and allow you to retrieve them later.
115+
## Invoking conformance tests
117116

117+
**As a Service Mesh user**
118+
Meshery allows you to schedule tests and invoke them programmatically. Meshery will store these test results and allow you to retrieve them later.
119+
120+
**As a Service Mesh maker**
121+
Meshery guarantees provenance of these tests and facilitates the public publicing of this suite of tests results into a versioned, public matrix of conformance status (consisting of both supported capabilities and test compliance).
122+
<!--
118123
## Testing Manually
119124
120125
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:
@@ -128,7 +133,7 @@ docker build . -t meshery-smi-conformance:latest
128133
docker run -p 10008:10008 meshery-smi-conformance:latest
129134
```
130135
131-
<!--
136+
132137
```shell
133138
kubectl kuttl test --skip-cluster-delete=true --start-kind=false ./smi-test
134139
```

smi-conformance/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ FROM alpine:latest
1414
RUN apk --no-cache add ca-certificates && mkdir /home/test-yamls && mkdir /home/test-yamls/traffic-access && mkdir /home/test-yamls/traffic-spec && mkdir /home/test-yamls/traffic-split
1515
COPY --from=build-img /home/meshery/** /home/
1616
COPY --from=build-img /go/src/github.com/layer5io/learn-layer5/smi-conformance/test-gen/test-yamls/traffic-access/** /home/test-yamls/traffic-access/
17-
COPY --from=build-img /go/src/github.com/layer5io/learn-layer5/smi-conformance/test-gen/test-yamls/test-split/** /home/test-yamls/traffic-split/
18-
COPY --from=build-img /go/src/github.com/layer5io/learn-layer5/smi-conformance/test-gen/test-yamls/test-spec/** /home/test-yamls/traffic-spec/
17+
COPY --from=build-img /go/src/github.com/layer5io/learn-layer5/smi-conformance/test-gen/test-yamls/traffic-split/** /home/test-yamls/traffic-split/
18+
COPY --from=build-img /go/src/github.com/layer5io/learn-layer5/smi-conformance/test-gen/test-yamls/traffic-spec/** /home/test-yamls/traffic-spec/
1919
WORKDIR /home/
2020
EXPOSE 10008
2121
CMD ["sh","-c","./smi_conformance"]

smi-conformance/test-gen/test_gen.go

Lines changed: 71 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/json"
55
"fmt"
66
"testing"
7+
"time"
78

89
harness "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1"
910
"github.com/kudobuilder/kuttl/pkg/report"
@@ -28,44 +29,43 @@ type Results struct {
2829
} `json:"testcase"`
2930
}
3031

32+
<<<<<<< HEAD
3133
func RunTest(meshConfig ServiceMesh, annotations, labels map[string]string) Results {
3234
manifestDirs := []string{}
3335
output := Results{}
3436
results := &report.Testsuites{}
37+
=======
38+
func RunTest(meshConfig ServiceMesh, annotations map[string]string) Results {
39+
>>>>>>> 4ac32010a115d1a96483e11b380fbc97259d70fd
3540

36-
// Run all testCases
37-
testToRun := ""
38-
// Run only traffic-split
39-
// testToRun := "traffic-split"
41+
c := make(chan Results)
42+
go func() {
43+
manifestDirs := []string{}
44+
results := &report.Testsuites{}
45+
output := Results{}
4046

41-
startKIND := false
42-
options := harness.TestSuite{}
47+
// Run all testCases
48+
testToRun := ""
49+
// Run only traffic-split
50+
// testToRun := "traffic-split"
4351

44-
args := []string{"./test-yamls/"}
52+
startKIND := false
53+
options := harness.TestSuite{}
4554

46-
options.TestDirs = args
47-
options.Timeout = 30
48-
options.Parallel = 1
49-
options.TestDirs = manifestDirs
50-
options.StartKIND = startKIND
51-
options.SkipDelete = true
55+
args := []string{"./test-yamls/"}
5256

53-
if options.KINDContext == "" {
54-
options.KINDContext = harness.DefaultKINDContext
55-
}
56-
57-
if len(args) != 0 {
5857
options.TestDirs = args
59-
}
60-
61-
// annotations := make(map[string]string)
62-
// Namespace Injection
63-
// annotations["linkerd.io/inject"] = "enabled"
64-
65-
serviceMeshConfObj := SMIConformance{
66-
SMObj: meshConfig,
67-
}
58+
options.Timeout = 30
59+
options.Parallel = 1
60+
options.TestDirs = manifestDirs
61+
options.StartKIND = startKIND
62+
options.SkipDelete = true
63+
64+
if options.KINDContext == "" {
65+
options.KINDContext = harness.DefaultKINDContext
66+
}
6867

68+
<<<<<<< HEAD
6969
testHandlers := make(map[string]map[string]test.CustomTest)
7070
testHandlers["traffic-access"] = serviceMeshConfObj.TrafficAccessGetTests()
7171
testHandlers["traffic-spec"] = serviceMeshConfObj.TrafficSpecGetTests()
@@ -78,22 +78,52 @@ func RunTest(meshConfig ServiceMesh, annotations, labels map[string]string) Resu
7878
SuiteCustomTests: testHandlers,
7979
NamespaceAnnotations: annotations,
8080
NamespaceLabels: labels,
81+
=======
82+
if len(args) != 0 {
83+
options.TestDirs = args
84+
>>>>>>> 4ac32010a115d1a96483e11b380fbc97259d70fd
8185
}
8286

83-
// Runs the test using the inCluster kubeConfig (runs only when the code is running inside the pod)
84-
harness.InCluster = true
85-
86-
s, _ := json.MarshalIndent(options, "", " ")
87-
fmt.Printf("Running integration tests with following options:\n%s\n", string(s))
88-
results = harness.Run()
89-
data, _ := json.Marshal(results)
90-
// Results of the test
91-
fmt.Printf("Results :\n%v\n", string(data))
92-
err := json.Unmarshal([]byte(data), &output)
93-
if err != nil {
94-
fmt.Printf("Unable to unmarshal results")
87+
// annotations := make(map[string]string)
88+
// Namespace Injection
89+
// annotations["linkerd.io/inject"] = "enabled"
90+
91+
serviceMeshConfObj := SMIConformance{
92+
SMObj: meshConfig,
9593
}
96-
})
9794

98-
return output
95+
testHandlers := make(map[string]map[string]test.CustomTest)
96+
testHandlers["traffic-access"] = serviceMeshConfObj.TrafficAccessGetTests()
97+
testHandlers["traffic-spec"] = serviceMeshConfObj.TrafficSpecGetTests()
98+
testHandlers["traffic-split"] = serviceMeshConfObj.TrafficSplitGetTests()
99+
100+
testutils.RunTests("kudo", testToRun, options.Parallel, func(t *testing.T) {
101+
harness := test.Harness{
102+
TestSuite: options,
103+
T: t,
104+
SuiteCustomTests: testHandlers,
105+
NamespaceAnnotations: annotations,
106+
}
107+
108+
// Runs the test using the inCluster kubeConfig (runs only when the code is running inside the pod)
109+
harness.InCluster = true
110+
111+
s, _ := json.MarshalIndent(options, "", " ")
112+
fmt.Printf("Running integration tests with following options:\n%s\n", string(s))
113+
results = harness.Run()
114+
data, _ := json.Marshal(results)
115+
// Results of the test
116+
fmt.Printf("Results :\n%v\n", string(data))
117+
err := json.Unmarshal([]byte(data), &output)
118+
if err != nil {
119+
fmt.Printf("Unable to unmarshal results")
120+
}
121+
c <- output
122+
time.Sleep(5 * time.Second)
123+
})
124+
}()
125+
select {
126+
case x := <-c:
127+
return x
128+
}
99129
}

0 commit comments

Comments
 (0)