Skip to content

Commit 28119d1

Browse files
authored
Merge pull request #35 from layer5io/addLabels
Add labels for istio
2 parents 4ac3201 + ee025ab commit 28119d1

File tree

6 files changed

+139
-109
lines changed

6 files changed

+139
-109
lines changed

smi-conformance/conformance/conformance.pb.go

Lines changed: 115 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

smi-conformance/conformance/conformance.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ option go_package = "conformance;conformance";
55

66
message Request {
77
map<string, string> annotations=1;
8-
string meshname = 2;
8+
map<string, string> labels=2;
9+
string meshname = 3;
910
}
1011

1112
message SingleTestResult {

smi-conformance/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/layer5io/learn-layer5/smi-conformance
22

33
go 1.13
44

5-
replace github.com/kudobuilder/kuttl => github.com/layer5io/kuttl v0.4.1-0.20200723152044-916f10574334
5+
replace github.com/kudobuilder/kuttl => github.com/layer5io/kuttl v0.4.1-0.20200806180306-b7e46afd657f
66

77
require (
88
github.com/golang/protobuf v1.4.2

smi-conformance/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ github.com/kumarabd/gokit v0.2.0 h1:oK7utJ7OODFX+tAAQkDufMp4g/ooiJxYwNqaHf4ItUg=
287287
github.com/kumarabd/gokit v0.2.0/go.mod h1:PdII4jWKPVYICrdF/qU6B4GiRmV51uLVWH7npYnHBlo=
288288
github.com/layer5io/kuttl v0.4.1-0.20200723152044-916f10574334 h1:nPVyMtCMrSUI+YmYpXAJHOrI7fw00YxbeE1oFnx/Et4=
289289
github.com/layer5io/kuttl v0.4.1-0.20200723152044-916f10574334/go.mod h1:UmrVd7x+bNVKrpmKgTtfRiTKHZeNPcMjQproJ0vGwhE=
290+
github.com/layer5io/kuttl v0.4.1-0.20200806180306-b7e46afd657f h1:L424py/DKSmjUDk+CAisjtS2kHaYEJhsC/6bc7CCnKI=
291+
github.com/layer5io/kuttl v0.4.1-0.20200806180306-b7e46afd657f/go.mod h1:UmrVd7x+bNVKrpmKgTtfRiTKHZeNPcMjQproJ0vGwhE=
290292
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
291293
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
292294
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=

smi-conformance/grpc/handlers.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,29 @@ var (
2121
PortSvcB: "9091",
2222
PortSvcC: "9091",
2323
}
24+
istioConfig = &test_gen.Linkerd{
25+
PortSvcA: "9091",
26+
PortSvcB: "9091",
27+
PortSvcC: "9091",
28+
}
2429
)
2530

2631
func (s *Service) RunTest(ctx context.Context, req *conformance.Request) (*conformance.Response, error) {
2732
results := make([]*conformance.SingleTestResult, 0)
2833
var config test_gen.ServiceMesh
2934

35+
config = linkerdConfig
3036
switch req.Meshname {
3137
case "linkerd":
3238
config = linkerdConfig
39+
req.Annotations["linkerd.io/inject"] = "enabled"
3340
case "maesh":
3441
config = maeshConfig
42+
case "istio":
43+
req.Labels["istio-injection"] = "enabled"
3544
}
3645

37-
result := test_gen.RunTest(config, req.Annotations)
46+
result := test_gen.RunTest(config, req.Annotations, req.Labels)
3847
fmt.Printf("%+v\n", result)
3948
for _, res := range result.Testcase {
4049
results = append(results, &conformance.SingleTestResult{

smi-conformance/test-gen/test_gen.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type Results struct {
2929
} `json:"testcase"`
3030
}
3131

32-
func RunTest(meshConfig ServiceMesh, annotations map[string]string) Results {
32+
func RunTest(meshConfig ServiceMesh, annotations, labels map[string]string) Results {
3333

3434
c := make(chan Results)
3535
go func() {
@@ -58,14 +58,6 @@ func RunTest(meshConfig ServiceMesh, annotations map[string]string) Results {
5858
options.KINDContext = harness.DefaultKINDContext
5959
}
6060

61-
if len(args) != 0 {
62-
options.TestDirs = args
63-
}
64-
65-
// annotations := make(map[string]string)
66-
// Namespace Injection
67-
// annotations["linkerd.io/inject"] = "enabled"
68-
6961
serviceMeshConfObj := SMIConformance{
7062
SMObj: meshConfig,
7163
}
@@ -81,7 +73,15 @@ func RunTest(meshConfig ServiceMesh, annotations map[string]string) Results {
8173
T: t,
8274
SuiteCustomTests: testHandlers,
8375
NamespaceAnnotations: annotations,
76+
NamespaceLabels: labels,
8477
}
78+
if len(args) != 0 {
79+
options.TestDirs = args
80+
}
81+
82+
// annotations := make(map[string]string)
83+
// Namespace Injection
84+
// annotations["linkerd.io/inject"] = "enabled"
8585

8686
// Runs the test using the inCluster kubeConfig (runs only when the code is running inside the pod)
8787
harness.InCluster = true

0 commit comments

Comments
 (0)