1
+ name : " xDS Service Discovery Test"
2
+ description : " Auto test for xds service discovery"
3
+ runs :
4
+ using : composite
5
+ steps :
6
+ - name : build docker image
7
+ shell : bash
8
+ run : |
9
+ cd sermant-integration-tests/xds-service-test/product/spring-server/
10
+ minikube image build -t spring-server:1.0.0 .
11
+ cd ../spring-client/
12
+ minikube image build -t spring-client:1.0.0 .
13
+ eval $(minikube docker-env)
14
+ docker images
15
+ - name : start spring-client and spring-server
16
+ shell : bash
17
+ run : |
18
+ kubectl apply -f sermant-integration-tests/xds-service-test/script/discovery/spring-client-sermant-xds-open.yaml
19
+ kubectl apply -f sermant-integration-tests/xds-service-test/script/discovery/spring-server.yaml
20
+ - name : Wait for spring-client pod to be ready
21
+ shell : bash
22
+ run : |
23
+ kubectl wait --for=condition=ready pod -l app=spring-client --timeout=10s
24
+ kubectl wait --for=condition=ready pod -l app=spring-server --timeout=10s
25
+ kubectl port-forward svc/spring-client 8080:8080 &
26
+ - name : test one server
27
+ shell : bash
28
+ run : |
29
+ mvn test -Dxds.service.integration.test.type=DISCOVERY_ONE_SERVER_INSTANCE --file \
30
+ sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml
31
+ - name : stop spring-server
32
+ shell : bash
33
+ run : |
34
+ kubectl delete -f sermant-integration-tests/xds-service-test/script/discovery/spring-server.yaml
35
+ sleep 3s
36
+ - name : test the number of spring-server instances changes from 1 to 0
37
+ shell : bash
38
+ run : |
39
+ mvn test -Dxds.service.integration.test.type=DISCOVERY_ZERO_SERVER_INSTANCE --file \
40
+ sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml
41
+ - name : start spring-server with 2 replicas
42
+ shell : bash
43
+ run : |
44
+ kubectl apply -f sermant-integration-tests/xds-service-test/script/discovery/spring-server-2-replicas.yaml
45
+ kubectl wait --for=condition=ready pod -l app=spring-server --timeout=10s
46
+ sleep 2s
47
+ - name : test the number of spring-server instances changes from 0 to 2
48
+ shell : bash
49
+ run : |
50
+ mvn test -Dxds.service.integration.test.type=DISCOVERY_TWO_SERVER_INSTANCE --file \
51
+ sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml
52
+ - name : create istio token
53
+ shell : bash
54
+ run : |
55
+ kubectl create serviceaccount istio-test
56
+ TOKEN=$(kubectl create token istio-test --duration=1h --audience=istio-ca)
57
+ kubectl create secret generic istio-test-secret \
58
+ --from-literal=token=${TOKEN} \
59
+ --type="istio.io/key-and-cert" \
60
+ -n default
61
+ - name : restart spring-client and sermant xds service use security mode
62
+ shell : bash
63
+ run : |
64
+ kubectl delete -f sermant-integration-tests/xds-service-test/script/discovery/spring-client-sermant-xds-open.yaml
65
+ sleep 5s
66
+ kubectl apply -f sermant-integration-tests/xds-service-test/script/discovery/spring-client-sermant-xds-subscribe-secure.yaml
67
+ kubectl wait --for=condition=ready pod -l app=spring-client --timeout=10s
68
+ pkill -f "kubectl port-forward svc/spring-client"
69
+ kubectl port-forward svc/spring-client 8080:8080 &
70
+ - name : test sermant xds service use security mode
71
+ shell : bash
72
+ run : |
73
+ mvn test -Dxds.service.integration.test.type=SECRET --file \
74
+ sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml
75
+ - name : test subscribe to get service instance
76
+ shell : bash
77
+ run : |
78
+ mvn test -Dxds.service.integration.test.type=DISCOVERY_SUBSCRIBE --file \
79
+ sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml
80
+ - name : close all service
81
+ shell : bash
82
+ run : |
83
+ kubectl delete -f sermant-integration-tests/xds-service-test/script/discovery/spring-client-sermant-xds-subscribe-secure.yaml
84
+ kubectl delete -f sermant-integration-tests/xds-service-test/script/discovery/spring-server-2-replicas.yaml
0 commit comments