This is an automated email from the ASF dual-hosted git repository. ningjiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git
The following commit(s) were added to refs/heads/master by this push: new 2b73537 [SCB-823] Setup the test in kubernetes (#243) 2b73537 is described below commit 2b735373bd328a056c1a9e663ddee275725dfc73 Author: crystaldust <juzhenat...@gmail.com> AuthorDate: Fri Aug 10 21:28:18 2018 +0800 [SCB-823] Setup the test in kubernetes (#243) * Add the yaml files for kubernetes deployment * Rename the k8s demo folder to saga-k8s-demo/ * Re-organize the folder structure of k8s resource. Rename the saga-k8s-demo folder with saga-k8s-resources. The resources folder provide the base resources(alpha-server and postgresql) and other demos' k8s resources. spring-demo's resources is now included. * Add ASF header for yamls in base/ and spring-demo/ * Add jmeter for spring-demo load testing. - jmeter.yaml: The jmeter deployment - jmeter.configmap.yaml: The jmeter script content used by jmeter pod. * Move the jmeter resources to test folder * Add the README file for kuberenetes demos --- saga-demo/saga-k8s-resources/README.md | 72 ++++++ saga-demo/saga-k8s-resources/base/alpha.yaml | 54 ++++ saga-demo/saga-k8s-resources/base/postgresql.yaml | 60 +++++ .../saga-k8s-resources/spring-demo/booking.yaml | 73 ++++++ saga-demo/saga-k8s-resources/spring-demo/car.yaml | 55 ++++ .../saga-k8s-resources/spring-demo/hotel.yaml | 55 ++++ .../spring-demo/test/jmeter.configmap.yaml | 282 +++++++++++++++++++++ .../spring-demo/test/jmeter.yaml | 54 ++++ 8 files changed, 705 insertions(+) diff --git a/saga-demo/saga-k8s-resources/README.md b/saga-demo/saga-k8s-resources/README.md new file mode 100644 index 0000000..a10588c --- /dev/null +++ b/saga-demo/saga-k8s-resources/README.md @@ -0,0 +1,72 @@ +# Deploy & test saga with Kubernetes + +You can now play with saga under Kubernetes! + +The demos' Kubernetes resources are splitted into 3 categories: + +- **base**: The base resources that all demos needs under `base/` folder, including the `alpha-server` and `postgresql` database +- **demos**: The resources that each demo will consume, stored in the folder named with `xxx-demo/` +- **tests**: A [jmeter](https://jmeter.apache.org/) deployment is provided for each demo under the demo's `test/` folder, there is also a [Kubernetes configmap](http://kubernetes-v1-4.github.io/docs/user-guide/configmap/) where you can change and apply the jmeter test plans. So you can change the plan at any time and pull up the jmeter deployment to test the demos. + + + +## Get started + +All the Kubernetes objects will be deployed in the `servicecomb` namespace, so make sure it is there with the command: + +```bash +$ kubectl create namespace servicecomb +namespace "servicecomb" created +``` + +Let's take the `spring-demo` as the example, apply the base and demo resources: + +```bash +$ kubectl apply -f ./base +service "alpha-server" created +deployment "alphaserver" created +service "postgresql" created +deployment "database" created + +$ kubectl apply -f ./spring-demo +service "booking" created +deployment "booking" created +service "car" created +deployment "car" created +service "hotel" created +deployment "hotel" created + +``` + +Make sure all the services in the demo are up and running: + +```bash +$ kubectl get pods -n servicecomb +NAME READY STATUS RESTARTS AGE +alphaserver-6cb48898fc-tlqtb 1/1 Running 0 1d +booking-666c8f4dbb-k5glt 1/1 Running 0 4h +car-975d666f8-prs9p 1/1 Running 0 1d +database-796fc68b98-mhz8n 1/1 Running 0 1d +hotel-768b59dfcd-gc7sn 1/1 Running 0 1d +``` + +Then you can test the demo with jmeter, modify the configmap according to your test plan, then apply the test service to Kubernetes api server: + +```bash +$ vim ./spring-demo/test/jmeter.configmap.yaml +$ # edit the file as you wish, mind the identation of yamls +$ kubectl apply -f ./spring-demo/test/ +configmap "springdemo-jmeter-script" created +deployment "spring-demo-jmeter" created + +$ kubectl get pods -n servicecomb | grep jmeter +spring-demo-jmeter-6cfb679f58-sckkx 1/1 Running 0 12s +``` + +The jmeter deployment will keep testing the demo and generate the test result. For now the the result file is stored in the Kubernetes nodes under the path `/saga-jmeter-result/{demo_name}.jtl`. You can generate the HTML dashboard with the command: + +```bash +$ jmeter -g /saga-jmeter-result/{demo_name}.jtl -o output/ +``` + +We will try to provide more services to automate the dashboard generation in the future. diff --git a/saga-demo/saga-k8s-resources/base/alpha.yaml b/saga-demo/saga-k8s-resources/base/alpha.yaml new file mode 100644 index 0000000..47c0d5d --- /dev/null +++ b/saga-demo/saga-k8s-resources/base/alpha.yaml @@ -0,0 +1,54 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +apiVersion: v1 +kind: Service +metadata: + name: alpha-server + namespace: servicecomb + labels: + app: alphaserver +spec: + ports: + - port: 8080 + name: alpha + selector: + app: alphaserver +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: alphaserver + namespace: servicecomb +spec: + replicas: 1 + template: + metadata: + labels: + app: alphaserver + version: v1 + spec: + containers: + - name: alphaserver + image: alpha-server:0.3.0-SNAPSHOT + imagePullPolicy: IfNotPresent + # ports: + # - containerPort: 8080 + env: + - name: JAVA_OPTS + value: -Dspring.profiles.active=prd -Dalpha.server.port=8080 -Dspring.datasource.url=jdbc:postgresql://postgresql.servicecomb:5432/saga?useSSL=false +--- diff --git a/saga-demo/saga-k8s-resources/base/postgresql.yaml b/saga-demo/saga-k8s-resources/base/postgresql.yaml new file mode 100644 index 0000000..bf0290f --- /dev/null +++ b/saga-demo/saga-k8s-resources/base/postgresql.yaml @@ -0,0 +1,60 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +apiVersion: v1 +kind: Service +metadata: + # original docker-compose link: "database:postgresql.servicecomb.io" + # Since kubernetes doesn't allow a namespace with dot like "servicecomb.io", make sure the Pod and Service are under the default namespace to be accessible + name: postgresql + namespace: servicecomb + labels: + app: database +spec: + ports: + - port: 5432 + name: postgresql # The name cannot be 'http' + selector: + app: database +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: database + namespace: servicecomb +spec: + replicas: 1 + template: + metadata: + labels: + app: database + version: v1 + spec: + containers: + - name: postgresql + image: postgres + imagePullPolicy: IfNotPresent + ports: + - containerPort: 5432 + env: + - name: POSTGRES_DB + value: saga + - name: POSTGRES_USER + value: saga + - name: POSTGRES_PASSWORD + value: password +--- diff --git a/saga-demo/saga-k8s-resources/spring-demo/booking.yaml b/saga-demo/saga-k8s-resources/spring-demo/booking.yaml new file mode 100644 index 0000000..93fc151 --- /dev/null +++ b/saga-demo/saga-k8s-resources/spring-demo/booking.yaml @@ -0,0 +1,73 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +apiVersion: v1 +kind: Service +metadata: + name: booking + namespace: servicecomb + labels: + app: booking +spec: + ports: + - port: 8083 + targetPort: 8080 + name: http + selector: + app: booking +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: booking + namespace: servicecomb +spec: + replicas: 1 + template: + metadata: + labels: + app: booking + version: v1 + spec: + containers: + - name: booking + image: booking:0.3.0-SNAPSHOT + imagePullPolicy: IfNotPresent + env: + - name: JAVA_OPTS + value: -Dalpha.cluster.address=alpha-server.servicecomb:8080 -Dcar.service.address=http://car.servicecomb:8082 -Dhotel.service.address=http://hotel.servicecomb:8081 + ports: + - containerPort: 8080 +--- +# Only for debugging +# apiVersion: v1 +# kind: Service +# metadata: +# name: booking-nodeip +# namespace: servicecomb +# labels: +# app: booking +# spec: +# type: NodePort +# ports: +# - port: 8080 +# # targetPort: 8080 +# name: http +# externalIPs: ['$YOUR_NODE_IP'] +# selector: +# app: booking +# --- diff --git a/saga-demo/saga-k8s-resources/spring-demo/car.yaml b/saga-demo/saga-k8s-resources/spring-demo/car.yaml new file mode 100644 index 0000000..064ead2 --- /dev/null +++ b/saga-demo/saga-k8s-resources/spring-demo/car.yaml @@ -0,0 +1,55 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +apiVersion: v1 +kind: Service +metadata: + name: car + namespace: servicecomb + labels: + app: car +spec: + ports: + - port: 8082 + targetPort: 8080 + name: car + selector: + app: car +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: car + namespace: servicecomb +spec: + replicas: 1 + template: + metadata: + labels: + app: car + version: v1 + spec: + containers: + - name: car + image: car:0.3.0-SNAPSHOT + imagePullPolicy: IfNotPresent + env: + - name: JAVA_OPTS + value: -Dalpha.cluster.address=alpha-server.servicecomb:8080 + ports: + - containerPort: 8080 +--- diff --git a/saga-demo/saga-k8s-resources/spring-demo/hotel.yaml b/saga-demo/saga-k8s-resources/spring-demo/hotel.yaml new file mode 100644 index 0000000..ef1b052 --- /dev/null +++ b/saga-demo/saga-k8s-resources/spring-demo/hotel.yaml @@ -0,0 +1,55 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +apiVersion: v1 +kind: Service +metadata: + name: hotel + namespace: servicecomb + labels: + app: hotel +spec: + ports: + - port: 8081 + targetPort: 8080 + name: hotel + selector: + app: hotel +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: hotel + namespace: servicecomb +spec: + replicas: 1 + template: + metadata: + labels: + app: hotel + version: v1 + spec: + containers: + - name: hotel + image: hotel:0.3.0-SNAPSHOT + imagePullPolicy: IfNotPresent + env: + - name: JAVA_OPTS + value: -Dalpha.cluster.address=alpha-server.servicecomb:8080 + ports: + - containerPort: 8080 +--- diff --git a/saga-demo/saga-k8s-resources/spring-demo/test/jmeter.configmap.yaml b/saga-demo/saga-k8s-resources/spring-demo/test/jmeter.configmap.yaml new file mode 100644 index 0000000..065d8cf --- /dev/null +++ b/saga-demo/saga-k8s-resources/spring-demo/test/jmeter.configmap.yaml @@ -0,0 +1,282 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +apiVersion: v1 +kind: ConfigMap +metadata: + name: springdemo-jmeter-script + namespace: servicecomb +data: + saga.jmx: | + <?xml version="1.0" encoding="UTF-8"?> + <jmeterTestPlan version="1.2" properties="4.0" jmeter="4.0 r1823414"> + <hashTree> + <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true"> + <stringProp name="TestPlan.comments"></stringProp> + <boolProp name="TestPlan.functional_mode">false</boolProp> + <boolProp name="TestPlan.serialize_threadgroups">false</boolProp> + <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="TestPlan.user_define_classpath"></stringProp> + </TestPlan> + <hashTree> + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true"> + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> + <boolProp name="LoopController.continue_forever">false</boolProp> + <intProp name="LoopController.loops">-1</intProp> + </elementProp> + <stringProp name="ThreadGroup.num_threads">50</stringProp> + <stringProp name="ThreadGroup.ramp_time">100</stringProp> + <longProp name="ThreadGroup.start_time">1503917597000</longProp> + <longProp name="ThreadGroup.end_time">1503917597000</longProp> + <boolProp name="ThreadGroup.scheduler">true</boolProp> + <stringProp name="ThreadGroup.duration">300</stringProp> + <stringProp name="ThreadGroup.delay"></stringProp> + </ThreadGroup> + <hashTree> + <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true"> + <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> + <collectionProp name="Arguments.arguments"> + <elementProp name="" elementType="HTTPArgument"> + <boolProp name="HTTPArgument.always_encode">false</boolProp> + <stringProp name="Argument.value"></stringProp> + <stringProp name="Argument.metadata">=</stringProp> + </elementProp> + </collectionProp> + </elementProp> + <stringProp name="HTTPSampler.domain">localhost</stringProp> + <stringProp name="HTTPSampler.port">8080</stringProp> + <stringProp name="HTTPSampler.protocol"></stringProp> + <stringProp name="HTTPSampler.contentEncoding"></stringProp> + <stringProp name="HTTPSampler.path"></stringProp> + <stringProp name="HTTPSampler.concurrentPool">6</stringProp> + <stringProp name="HTTPSampler.connect_timeout"></stringProp> + <stringProp name="HTTPSampler.response_timeout"></stringProp> + </ConfigTestElement> + <hashTree/> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <collectionProp name="HeaderManager.headers"> + <elementProp name="" elementType="Header"> + <stringProp name="Header.name">Content-Type</stringProp> + <stringProp name="Header.value">application/json</stringProp> + </elementProp> + </collectionProp> + </HeaderManager> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Request" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain">booking.servicecomb</stringProp> + <stringProp name="HTTPSampler.port">8083</stringProp> + <stringProp name="HTTPSampler.protocol"></stringProp> + <stringProp name="HTTPSampler.contentEncoding"></stringProp> + <stringProp name="HTTPSampler.path">/booking/test/2/2</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"></stringProp> + <stringProp name="HTTPSampler.connect_timeout"></stringProp> + <stringProp name="HTTPSampler.response_timeout"></stringProp> + </HTTPSamplerProxy> + <hashTree/> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Request with error" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain">booking.servicecomb</stringProp> + <stringProp name="HTTPSampler.port">8083</stringProp> + <stringProp name="HTTPSampler.protocol"></stringProp> + <stringProp name="HTTPSampler.contentEncoding"></stringProp> + <stringProp name="HTTPSampler.path">/booking/test/3/2</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"></stringProp> + <stringProp name="HTTPSampler.connect_timeout"></stringProp> + <stringProp name="HTTPSampler.response_timeout"></stringProp> + </HTTPSamplerProxy> + <hashTree/> + <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true"> + <stringProp name="ConstantTimer.delay">100</stringProp> + </ConstantTimer> + <hashTree/> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="49586">200</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + <stringProp name="Assertion.custom_message"></stringProp> + </ResponseAssertion> + <hashTree/> + </hashTree> + <ResultCollector guiclass="GraphVisualizer" testclass="ResultCollector" testname="Graph Results" enabled="true"> + <boolProp name="ResultCollector.error_logging">false</boolProp> + <objProp> + <name>saveConfig</name> + <value class="SampleSaveConfiguration"> + <time>true</time> + <latency>true</latency> + <timestamp>true</timestamp> + <success>true</success> + <label>true</label> + <code>true</code> + <message>true</message> + <threadName>true</threadName> + <dataType>true</dataType> + <encoding>false</encoding> + <assertions>true</assertions> + <subresults>true</subresults> + <responseData>false</responseData> + <samplerData>false</samplerData> + <xml>false</xml> + <fieldNames>true</fieldNames> + <responseHeaders>false</responseHeaders> + <requestHeaders>false</requestHeaders> + <responseDataOnError>false</responseDataOnError> + <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> + <assertionsResultsToSave>0</assertionsResultsToSave> + <bytes>true</bytes> + <sentBytes>true</sentBytes> + <threadCounts>true</threadCounts> + <idleTime>true</idleTime> + <connectTime>true</connectTime> + </value> + </objProp> + <stringProp name="filename"></stringProp> + </ResultCollector> + <hashTree/> + <ResultCollector guiclass="TableVisualizer" testclass="ResultCollector" testname="View Results in Table" enabled="true"> + <boolProp name="ResultCollector.error_logging">false</boolProp> + <objProp> + <name>saveConfig</name> + <value class="SampleSaveConfiguration"> + <time>true</time> + <latency>true</latency> + <timestamp>true</timestamp> + <success>true</success> + <label>true</label> + <code>true</code> + <message>true</message> + <threadName>true</threadName> + <dataType>true</dataType> + <encoding>false</encoding> + <assertions>true</assertions> + <subresults>true</subresults> + <responseData>false</responseData> + <samplerData>false</samplerData> + <xml>false</xml> + <fieldNames>true</fieldNames> + <responseHeaders>false</responseHeaders> + <requestHeaders>false</requestHeaders> + <responseDataOnError>false</responseDataOnError> + <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> + <assertionsResultsToSave>0</assertionsResultsToSave> + <bytes>true</bytes> + <sentBytes>true</sentBytes> + <threadCounts>true</threadCounts> + <idleTime>true</idleTime> + <connectTime>true</connectTime> + </value> + </objProp> + <stringProp name="filename"></stringProp> + </ResultCollector> + <hashTree/> + <ResultCollector guiclass="AssertionVisualizer" testclass="ResultCollector" testname="Assertion Results" enabled="true"> + <boolProp name="ResultCollector.error_logging">false</boolProp> + <objProp> + <name>saveConfig</name> + <value class="SampleSaveConfiguration"> + <time>true</time> + <latency>true</latency> + <timestamp>true</timestamp> + <success>true</success> + <label>true</label> + <code>true</code> + <message>true</message> + <threadName>true</threadName> + <dataType>true</dataType> + <encoding>false</encoding> + <assertions>true</assertions> + <subresults>true</subresults> + <responseData>false</responseData> + <samplerData>false</samplerData> + <xml>false</xml> + <fieldNames>true</fieldNames> + <responseHeaders>false</responseHeaders> + <requestHeaders>false</requestHeaders> + <responseDataOnError>false</responseDataOnError> + <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> + <assertionsResultsToSave>0</assertionsResultsToSave> + <bytes>true</bytes> + <sentBytes>true</sentBytes> + <threadCounts>true</threadCounts> + <idleTime>true</idleTime> + <connectTime>true</connectTime> + </value> + </objProp> + <stringProp name="filename"></stringProp> + </ResultCollector> + <hashTree/> + <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report" enabled="true"> + <boolProp name="ResultCollector.error_logging">false</boolProp> + <objProp> + <name>saveConfig</name> + <value class="SampleSaveConfiguration"> + <time>true</time> + <latency>true</latency> + <timestamp>true</timestamp> + <success>true</success> + <label>true</label> + <code>true</code> + <message>true</message> + <threadName>true</threadName> + <dataType>true</dataType> + <encoding>false</encoding> + <assertions>true</assertions> + <subresults>true</subresults> + <responseData>false</responseData> + <samplerData>false</samplerData> + <xml>false</xml> + <fieldNames>true</fieldNames> + <responseHeaders>false</responseHeaders> + <requestHeaders>false</requestHeaders> + <responseDataOnError>false</responseDataOnError> + <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage> + <assertionsResultsToSave>0</assertionsResultsToSave> + <bytes>true</bytes> + <sentBytes>true</sentBytes> + <threadCounts>true</threadCounts> + <idleTime>true</idleTime> + <connectTime>true</connectTime> + </value> + </objProp> + <stringProp name="filename"></stringProp> + </ResultCollector> + <hashTree/> + </hashTree> + </hashTree> + </jmeterTestPlan> diff --git a/saga-demo/saga-k8s-resources/spring-demo/test/jmeter.yaml b/saga-demo/saga-k8s-resources/spring-demo/test/jmeter.yaml new file mode 100644 index 0000000..b631253 --- /dev/null +++ b/saga-demo/saga-k8s-resources/spring-demo/test/jmeter.yaml @@ -0,0 +1,54 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: spring-demo-jmeter + namespace: servicecomb +spec: + replicas: 1 + template: + metadata: + labels: + app: spring-demo-jmeter + version: v1 + spec: + containers: + - name: jmeter + image: justb4/jmeter + imagePullPolicy: IfNotPresent + # TODO ReplicaSet, ReplicationController, Deployment, Daemonset only allow restartPolicy to be 'Always' + # Maybe we should provide a custom test scheduler to scale up pods and let them exit naturally. + # restartPolicy: Never + args: ["-n", "-t", "/tmp/saga.jmx", "-l", "/tmp/jmeter-result/spring-demo.jtl"] + volumeMounts: + - name: jmeter-script + mountPath: /tmp/ + - name: result-dir + mountPath: /tmp/jmeter-result + lifecycle: + preStop: + exec: + command: ["echo", "jmeter finished"] + volumes: + - name: jmeter-script + configMap: + name: springdemo-jmeter-script + - name: result-dir + hostPath: + type: DirectoryOrCreate + path: /saga-jmeter-result/