diff --git a/docker-compose.yml b/docker-compose.yml index 261cd54d03..d79b90d511 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -787,4 +787,4 @@ services: timeout: 5s retries: 60 ports: - - 5432 \ No newline at end of file + - 5432 diff --git a/test/tracetesting/business-tests/environment-vars.yaml b/test/tracetesting/business-tests/environment-vars.env similarity index 100% rename from test/tracetesting/business-tests/environment-vars.yaml rename to test/tracetesting/business-tests/environment-vars.env diff --git a/test/tracetesting/business-tests/user-purchase-test-steps/01-add-product-to-cart.yaml b/test/tracetesting/business-tests/user-purchase-test-steps/01-add-product-to-cart.yaml index 4921028e50..62d8cb8a68 100644 --- a/test/tracetesting/business-tests/user-purchase-test-steps/01-add-product-to-cart.yaml +++ b/test/tracetesting/business-tests/user-purchase-test-steps/01-add-product-to-cart.yaml @@ -16,4 +16,4 @@ spec: - name: "The product was persisted correctly on the shopping cart" selector: span[name="oteldemo.CartService/AddItem"] assertions: - - attr:app.product.id = "${env:PRODUCT_ID}" \ No newline at end of file + - attr:app.product.id = "${env:PRODUCT_ID}" diff --git a/test/tracetesting/business-tests/user-purchase-test-steps/02-checking-out-cart.yaml b/test/tracetesting/business-tests/user-purchase-test-steps/02-checking-out-cart.yaml index 5155b0d970..02cc90ea7d 100644 --- a/test/tracetesting/business-tests/user-purchase-test-steps/02-checking-out-cart.yaml +++ b/test/tracetesting/business-tests/user-purchase-test-steps/02-checking-out-cart.yaml @@ -11,7 +11,25 @@ spec: headers: - key: Content-Type value: application/json - body: '{"userId":"${env:USER_ID}","email":"someone@example.com","address":{"streetAddress":"1600 Amphitheatre Parkway","state":"CA","country":"United States","city":"Mountain View","zipCode":"94043"},"userCurrency":"USD","creditCard":{"creditCardCvv":672,"creditCardExpirationMonth":1,"creditCardExpirationYear":2030,"creditCardNumber":"4432-8015-6152-0454"}}' + body: | + { + "userId": "${env:USER_ID}", + "email": "someone@example.com", + "address": { + "streetAddress": "1600 Amphitheatre Parkway", + "state": "CA", + "country": "United States", + "city": "Mountain View", + "zipCode": "94043" + }, + "userCurrency": "USD", + "creditCard": { + "creditCardCvv": 672, + "creditCardExpirationMonth": 1, + "creditCardExpirationYear": 2030, + "creditCardNumber": "4432-8015-6152-0454" + } + } specs: - selector: span[tracetest.span.type="rpc" name="oteldemo.CheckoutService/PlaceOrder" rpc.system="grpc" rpc.method="PlaceOrder" rpc.service="oteldemo.CheckoutService"] name: "The order was placed" @@ -32,4 +50,4 @@ spec: name: "The cart was emptied" assertions: - attr:rpc.grpc.status_code = 0 - - attr:tracetest.selected_spans.count >= 1 \ No newline at end of file + - attr:tracetest.selected_spans.count >= 1 diff --git a/test/tracetesting/business-tests/user-purchase.yaml b/test/tracetesting/business-tests/user-purchase.yaml index 3ebf75b7c1..ed5e897f36 100644 --- a/test/tracetesting/business-tests/user-purchase.yaml +++ b/test/tracetesting/business-tests/user-purchase.yaml @@ -5,4 +5,4 @@ spec: description: Simulate a process of a user purchasing products on Astronomy store steps: - ./user-purchase-test-steps/01-add-product-to-cart.yaml - - ./user-purchase-test-steps/02-checking-out-cart.yaml \ No newline at end of file + - ./user-purchase-test-steps/02-checking-out-cart.yaml diff --git a/test/tracetesting/run.bash b/test/tracetesting/run.bash index 5b1177f8f8..36989106dc 100755 --- a/test/tracetesting/run.bash +++ b/test/tracetesting/run.bash @@ -21,14 +21,18 @@ echo "Starting tests..." EXIT_STATUS=0 -# run business tests -run_tracetest_with_env ./business-tests/user-purchase.yaml ./business-tests/environment-vars.yaml || EXIT_STATUS=$? - # run tech based tests +echo "" +echo "Running tech based tests..." run_tracetest ./tech-based-tests/ad-get.yaml || EXIT_STATUS=$? run_tracetest ./tech-based-tests/currency-convert.yaml || EXIT_STATUS=$? run_tracetest ./tech-based-tests/currency-supported.yaml || EXIT_STATUS=$? +# run business tests +echo "" +echo "Running business based tests..." +run_tracetest_with_env ./business-tests/user-purchase.yaml ./business-tests/environment-vars.env || EXIT_STATUS=$? + echo "" echo "Tests done! Exit code: $EXIT_STATUS" diff --git a/test/tracetesting/tech-based-tests/ad-get.yaml b/test/tracetesting/tech-based-tests/ad-get.yaml index 73f822f00e..9c485bcfa0 100644 --- a/test/tracetesting/tech-based-tests/ad-get.yaml +++ b/test/tracetesting/tech-based-tests/ad-get.yaml @@ -332,3 +332,13 @@ spec: { "contextKeys": [ "galaxy", "telescope" ] } + specs: + - name: It returns two ads + selector: span[tracetest.span.type="rpc" name="oteldemo.AdService/GetAds" rpc.system="grpc" rpc.method="GetAds" rpc.service="oteldemo.AdService"] + assertions: + - attr:app.ads.count = 2 + - name: It returns a valid redirectUrl for each ads + selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:tracetest.response.body | json_path '$.ads[0].redirectUrl' contains "/product/" + - attr:tracetest.response.body | json_path '$.ads[1].redirectUrl' contains "/product/" diff --git a/test/tracetesting/tech-based-tests/currency-convert.yaml b/test/tracetesting/tech-based-tests/currency-convert.yaml index a31e07431d..3cd9811855 100644 --- a/test/tracetesting/tech-based-tests/currency-convert.yaml +++ b/test/tracetesting/tech-based-tests/currency-convert.yaml @@ -347,4 +347,4 @@ spec: - name: It has more nanos than expected selector: span[tracetest.span.type="general" name="Tracetest trigger"] assertions: - - attr:tracetest.response.body| json_path '$.nanos' >= 599380800 \ No newline at end of file + - attr:tracetest.response.body| json_path '$.nanos' >= 599380800 diff --git a/test/tracetesting/tracetest-config.yaml b/test/tracetesting/tracetest-config.yaml index b1d421260c..74196206d7 100644 --- a/test/tracetesting/tracetest-config.yaml +++ b/test/tracetesting/tracetest-config.yaml @@ -10,7 +10,7 @@ telemetry: exporters: collector: serviceName: tracetest - sampling: 100 # 100% + sampling: 100 exporter: type: collector collector: @@ -18,4 +18,4 @@ telemetry: server: telemetry: - exporter: collector \ No newline at end of file + exporter: collector diff --git a/test/tracetesting/tracetest-provision.yaml b/test/tracetesting/tracetest-provision.yaml index 7a02540a43..e07899819a 100644 --- a/test/tracetesting/tracetest-provision.yaml +++ b/test/tracetesting/tracetest-provision.yaml @@ -25,4 +25,4 @@ spec: jaeger: endpoint: jaeger:16685 tls: - insecure: true \ No newline at end of file + insecure: true