Skip to content

Commit

Permalink
Update default version test files
Browse files Browse the repository at this point in the history
  • Loading branch information
sgayangi committed Sep 30, 2024
1 parent 476532c commit a9de55f
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 158 deletions.
2 changes: 0 additions & 2 deletions adapter/internal/operator/controllers/dp/api_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"strings"
"sync"

"github.com/sirupsen/logrus"
"github.com/wso2/apk/adapter/config"
"github.com/wso2/apk/adapter/internal/controlplane"
"github.com/wso2/apk/adapter/internal/discovery/xds"
Expand Down Expand Up @@ -1517,7 +1516,6 @@ func (apiReconciler *APIReconciler) getAPIForGRPCRoute(ctx context.Context, obj
}

apiList := &dpv1alpha3.APIList{}
logrus.Info("=============GETTING API FOR GRPC ROUTE================")

if err := apiReconciler.client.List(ctx, apiList, &k8client.ListOptions{
FieldSelector: fields.OneTermEqualSelector(grpcRouteAPIIndex, utils.NamespacedName(grpcRoute).String()),
Expand Down
28 changes: 13 additions & 15 deletions test/integration/integration/tests/grpc-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"testing"

"github.com/wso2/apk/test/integration/integration/utils/grpc-code/student"
"github.com/wso2/apk/test/integration/integration/utils/grpc-code/student_default_version"
"github.com/wso2/apk/test/integration/integration/utils/grpcutils"
"github.com/wso2/apk/test/integration/integration/utils/suite"
)
Expand All @@ -37,7 +36,6 @@ var GRPCAPI = suite.IntegrationTest{
Manifests: []string{"tests/grpc-api.yaml"},
Test: func(t *testing.T, suite *suite.IntegrationTestSuite) {
gwAddr := "grpc.test.gw.wso2.com:9095"

testCases := []grpcutils.GRPCTestCase{
{
ExpectedResponse: grpcutils.ExpectedResponse{
Expand All @@ -52,19 +50,19 @@ var GRPCAPI = suite.IntegrationTest{
Method: student.GetStudent,
Satisfier: student.StudentResponseSatisfier{},
},
{
ExpectedResponse: grpcutils.ExpectedResponse{
Out: &student_default_version.StudentResponse{
Name: "Student",
Age: 10,
},
Err: nil,
},
ActualResponse: &student_default_version.StudentResponse{},
Name: "Get Student Details (Default API Version)",
Method: student_default_version.GetStudent,
Satisfier: student_default_version.StudentResponseSatisfier{},
},
// {
// ExpectedResponse: grpcutils.ExpectedResponse{
// Out: &student_default_version.StudentResponse{
// Name: "Student",
// Age: 10,
// },
// Err: nil,
// },
// ActualResponse: &student_default_version.StudentResponse{},
// Name: "Get Student Details (Default API Version)",
// Method: student_default_version.GetStudent,
// Satisfier: student_default_version.StudentResponseSatisfier{},
// },
}
for i := range testCases {
tc := testCases[i]
Expand Down
14 changes: 13 additions & 1 deletion test/integration/integration/tests/resources/base/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,23 @@ spec:
app: grpc-backend-v1
spec:
containers:
- name: grpc-backend
- name: grpc-backend-v1
image: sega1234/student-service:1.0.0
imagePullPolicy: Always
ports:
- containerPort: 9090
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
resources:
requests:
cpu: 10m
---
apiVersion: v1
kind: Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (srs StudentResponseSatisfier) IsSatisfactory(response any, expectedRespons
}
}
func GetStudent(conn *grpc.ClientConn) (any, error) {
c := NewStudentServiceClient(conn)
c := NewStudentServiceDefaultVersionClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
r := &StudentRequest{Id: 1234}
Expand Down
Loading

0 comments on commit a9de55f

Please sign in to comment.