Skip to content

Commit

Permalink
Merge pull request #35 from layer5io/addLabels
Browse files Browse the repository at this point in the history
Add labels for istio
  • Loading branch information
leecalcote authored Aug 9, 2020
2 parents 4ac3201 + ee025ab commit 28119d1
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 109 deletions.
212 changes: 115 additions & 97 deletions smi-conformance/conformance/conformance.pb.go

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion smi-conformance/conformance/conformance.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ option go_package = "conformance;conformance";

message Request {
map<string, string> annotations=1;
string meshname = 2;
map<string, string> labels=2;
string meshname = 3;
}

message SingleTestResult {
Expand Down
2 changes: 1 addition & 1 deletion smi-conformance/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/layer5io/learn-layer5/smi-conformance

go 1.13

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

require (
github.com/golang/protobuf v1.4.2
Expand Down
2 changes: 2 additions & 0 deletions smi-conformance/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ github.com/kumarabd/gokit v0.2.0 h1:oK7utJ7OODFX+tAAQkDufMp4g/ooiJxYwNqaHf4ItUg=
github.com/kumarabd/gokit v0.2.0/go.mod h1:PdII4jWKPVYICrdF/qU6B4GiRmV51uLVWH7npYnHBlo=
github.com/layer5io/kuttl v0.4.1-0.20200723152044-916f10574334 h1:nPVyMtCMrSUI+YmYpXAJHOrI7fw00YxbeE1oFnx/Et4=
github.com/layer5io/kuttl v0.4.1-0.20200723152044-916f10574334/go.mod h1:UmrVd7x+bNVKrpmKgTtfRiTKHZeNPcMjQproJ0vGwhE=
github.com/layer5io/kuttl v0.4.1-0.20200806180306-b7e46afd657f h1:L424py/DKSmjUDk+CAisjtS2kHaYEJhsC/6bc7CCnKI=
github.com/layer5io/kuttl v0.4.1-0.20200806180306-b7e46afd657f/go.mod h1:UmrVd7x+bNVKrpmKgTtfRiTKHZeNPcMjQproJ0vGwhE=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
Expand Down
11 changes: 10 additions & 1 deletion smi-conformance/grpc/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,29 @@ var (
PortSvcB: "9091",
PortSvcC: "9091",
}
istioConfig = &test_gen.Linkerd{
PortSvcA: "9091",
PortSvcB: "9091",
PortSvcC: "9091",
}
)

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

config = linkerdConfig
switch req.Meshname {
case "linkerd":
config = linkerdConfig
req.Annotations["linkerd.io/inject"] = "enabled"
case "maesh":
config = maeshConfig
case "istio":
req.Labels["istio-injection"] = "enabled"
}

result := test_gen.RunTest(config, req.Annotations)
result := test_gen.RunTest(config, req.Annotations, req.Labels)
fmt.Printf("%+v\n", result)
for _, res := range result.Testcase {
results = append(results, &conformance.SingleTestResult{
Expand Down
18 changes: 9 additions & 9 deletions smi-conformance/test-gen/test_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Results struct {
} `json:"testcase"`
}

func RunTest(meshConfig ServiceMesh, annotations map[string]string) Results {
func RunTest(meshConfig ServiceMesh, annotations, labels map[string]string) Results {

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

if len(args) != 0 {
options.TestDirs = args
}

// annotations := make(map[string]string)
// Namespace Injection
// annotations["linkerd.io/inject"] = "enabled"

serviceMeshConfObj := SMIConformance{
SMObj: meshConfig,
}
Expand All @@ -81,7 +73,15 @@ func RunTest(meshConfig ServiceMesh, annotations map[string]string) Results {
T: t,
SuiteCustomTests: testHandlers,
NamespaceAnnotations: annotations,
NamespaceLabels: labels,
}
if len(args) != 0 {
options.TestDirs = args
}

// annotations := make(map[string]string)
// Namespace Injection
// annotations["linkerd.io/inject"] = "enabled"

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

0 comments on commit 28119d1

Please sign in to comment.