Skip to content

Commit

Permalink
chore(examples): environment provision example (#3867)
Browse files Browse the repository at this point in the history
* chore(examples): environment provision example

* feat(cli): enabling environment provisioning
  • Loading branch information
xoscar authored May 24, 2024
1 parent 5bc9559 commit 645d59f
Show file tree
Hide file tree
Showing 14 changed files with 182 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/environment-automation/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: Environment
spec:
id: ttenv_dd3bb7e26a187dc1
name: my-demo-environment-4
description: My environment description
resources: ./resources
agentConfiguration:
serverless: true
14 changes: 14 additions & 0 deletions examples/environment-automation/resources/datastore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
type: DataStore
spec:
id: current
name: jaeger
type: jaeger
default: true
createdAt: 2023-10-16T19:39:35.345567Z
jaeger:
endpoint: demo-pokeshop-jaeger-query.demo:16685
headers:
"": ""
tls:
insecure: true
settings: {}
6 changes: 6 additions & 0 deletions examples/environment-automation/resources/emailinvite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: Invite
spec:
id: pqx2w0PSR
to: pedro10@kubeshop.io
role: engineers
status: pending
7 changes: 7 additions & 0 deletions examples/environment-automation/resources/envtoken.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: EnvironmentToken
spec:
id: GI1su-PIg
name: my-engineers-token
role: engineers
isRevoked: false

13 changes: 13 additions & 0 deletions examples/environment-automation/resources/google.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: Test
spec:
id: google-test
name: Google
trigger:
type: http
httpRequest:
method: GET
url: google.com
headers:
- key: Content-Type
value: application/json
skipTraceCollection: true
13 changes: 13 additions & 0 deletions examples/environment-automation/resources/more-tests/facebook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: Test
spec:
id: facebook-test
name: Facebook
trigger:
type: http
httpRequest:
method: GET
url: facebook.com
headers:
- key: Content-Type
value: application/json
skipTraceCollection: true
13 changes: 13 additions & 0 deletions examples/environment-automation/resources/more-tests/twitter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: Test
spec:
id: twitter-test
name: Twitter
trigger:
type: http
httpRequest:
method: GET
url: twitter.com
headers:
- key: Content-Type
value: application/json
skipTraceCollection: true
10 changes: 10 additions & 0 deletions examples/environment-automation/resources/pollingprofile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type: PollingProfile
spec:
id: Mj4Xw2PSR
name: my-new-default-profile
default: true
strategy: periodic
periodic:
retryDelay: 2s
timeout: 30s
selectorMatchRetries: 5
6 changes: 6 additions & 0 deletions examples/environment-automation/resources/runner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: TestRunner
spec:
id: current
name: default
requiredGates:
- test-specs
7 changes: 7 additions & 0 deletions examples/environment-automation/resources/suite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: TestSuite
spec:
id: test-suite
name: test-suite
description: ""
steps:
- google-test
13 changes: 13 additions & 0 deletions examples/environment-automation/resources/tracetest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: Test
spec:
id: tracetest-test
name: Tracetest
trigger:
type: http
httpRequest:
method: GET
url: tracetest.io
headers:
- key: Content-Type
value: application/json
skipTraceCollection: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
type: Test
spec:
id: pokeshop-demo-import-pokemon-queue
name: Import a Pokemon using API and MQ Worker
description: Import a Pokemon
trigger:
type: http
httpRequest:
method: POST
url: https://demo-pokeshop.stage.tracetest.io/pokemon/import
body: "{\n \"id\": 143\n}\n"
headers:
- key: Content-Type
value: application/json
specs:
- selector: span[tracetest.span.type="http" name="POST /pokemon/import" http.method="POST"]
name: POST /pokemon/import was called successfuly
assertions:
- attr:http.status_code = 200
- attr:http.response.body | json_path '$.id' = "143"
- selector: span[tracetest.span.type="general" name="validate request"]
name: The request was validated correctly
assertions:
- attr:validation.is_valid = "true"
- selector: span[tracetest.span.type="messaging" name="queue.synchronizePokemon publish" messaging.system="rabbitmq" messaging.destination="queue.synchronizePokemon" messaging.operation="publish"]
name: A message was enqueued to the worker
assertions:
- attr:messaging.payload | json_path '$.id' = "143"
- selector: span[tracetest.span.type="messaging" name="queue.synchronizePokemon process" messaging.system="rabbitmq" messaging.destination="queue.synchronizePokemon" messaging.operation="process"]
name: A message was read by the worker
assertions:
- attr:messaging.payload | json_path '$.fields.routingKey' = "queue.synchronizePokemon"
- selector: span[tracetest.span.type="general" name="import pokemon"]
name: A "import pokemon" action was triggered
assertions:
- attr:tracetest.selected_spans.count >= 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
type: Test
spec:
id: pokeshop-demo-list-pokemon
name: List Pokemons
description: List Pokemons registered on Pokeshop API
trigger:
type: http
httpRequest:
method: GET
url: https://demo-pokeshop.stage.tracetest.io/pokemon?take=100&skip=0
headers:
- key: Content-Type
value: application/json
specs:
- selector: span[tracetest.span.type="http" name="GET /pokemon?take=100&skip=0" http.method="GET"]
name: GET /pokemon endpoint was called and returned valid data
assertions:
- attr:http.status_code = 200
- selector: span[tracetest.span.type="database" name="count pokeshop.pokemon" db.system="postgres" db.name="pokeshop" db.user="ashketchum" db.operation="count" db.sql.table="pokemon"]
name: A count operation was triggered on database
assertions:
- attr:db.operation = "count"
- selector: span[tracetest.span.type="database" name="findMany pokeshop.pokemon" db.system="postgres" db.name="pokeshop" db.user="ashketchum" db.operation="findMany" db.sql.table="pokemon"]
name: A select operation was triggered on database
assertions:
- attr:db.operation = "findMany"
10 changes: 10 additions & 0 deletions examples/environment-automation/resources/tracetests/suite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type: TestSuite
spec:
id: pokeshop-demo-test-suite
name: Pokeshop Synthetic tests
description: Simulate a user doing a series of imports on Pokeshop and listing its results
steps:
- pokeshop-demo-add-pokemon
- pokeshop-demo-import-pokemon-queue
- pokeshop-demo-import-pokemon-stream
- pokeshop-demo-list-pokemon

0 comments on commit 645d59f

Please sign in to comment.