Skip to content

Commit 6301dbd

Browse files
authored
fix(docs): fixing docs build and variable sets (#3047)
* fix(docs): fixing docs build and variable sets * Fixing test suite id param * pr comments
1 parent 6314696 commit 6301dbd

22 files changed

+102
-173
lines changed

docs/docs/cli/creating-environments.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

docs/docs/cli/creating-test-outputs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Defining Test Outputs in Text Files
22

3-
Outputs are really useful when running [Transactions](../concepts/transactions). They allow for exporting values from a test so they become available in the [Environment Variables](../concepts/variable-sets.md) of the current transaction.
3+
Outputs are really useful when running [Transactions](../concepts/transactions). They allow for exporting values from a test so they become available in the [Variable Sets](../concepts/variable-sets.md) of the current transaction.
44

55
## Outputs are Expression Results
66

7-
An output exports the result of an [Expression](../concepts/expressions) and assigns it to a name, so it can be injected into the environment variables of a running transaction.
7+
An output exports the result of an [Expression](../concepts/expressions) and assigns it to a name, so it can be injected into the variable set of a running transaction.
88
A `selector` is needed only if the provided expression refers to a/some span/s attribute or meta attributes.
99

1010
It can be defined using the following YAML definition:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Defining Variable Sets as Text Files
2+
3+
This page showcases how to create and edit variable sets with the CLI.
4+
5+
:::tip
6+
[To read more about variable sets check out variable sets concepts.](../concepts/variable-sets.md)
7+
:::
8+
9+
Just like Data Stores, you can also manage your variable sets using the CLI and definition files.
10+
11+
A definition file looks like the following:
12+
13+
```yaml
14+
type: VariableSet
15+
spec:
16+
name: Production
17+
description: Production env variables
18+
values:
19+
- key: URL
20+
value: https://app-production.company.com
21+
- key: API_KEY
22+
value: mysecret
23+
```
24+
25+
In order to apply this configuration to your Tracetest instance, make sure to have your [CLI configured](./configuring-your-cli.md) and run:
26+
27+
```sh
28+
tracetest apply variableset -f <variableset.yaml>
29+
```
30+
31+
> If the file contains the property `spec.id`, the operation will be considered a variable set update. If you try to apply a variable set and you get the error: `could not apply variableset: 404 Not Found`, it means the provided ID doesn't exist. Either update the ID to reference an existing variable set or remove the property from the file. Tracetest will create a new variable set and a new ID.

docs/docs/cli/running-tests.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,24 +186,24 @@ The JUnit output file would then contain the JUnit result, for example:
186186
</testsuites>
187187
```
188188

189-
## Running a Test That Uses Environment Variables
189+
## Running a Test That Uses Variable Sets
190190

191-
There are two ways of referencing an environment when running a test.
191+
There are two ways of referencing a variable set when running a test.
192192

193-
You can reference an existing environment using its id. For example, given this defined environment with an id of 'testenv':
193+
You can reference an existing variable set using its id. For example, given this defined variable set with an id of 'testenv':
194194

195195
![testenv](../img/show-environment-definition.png)
196196

197-
We can run a test and specify that environment with this command:
197+
We can run a test and specify that variable set with this command:
198198

199199
```sh
200200
tracetest run test -f path/to/test.yaml -e testenv
201201
```
202202

203-
You can also reference an environment resource file which will be used to create a new environment or update an existing one. For example, if you have a file named local.env with this content:
203+
You can also reference a variable set resource file which will be used to create a new variable set or update an existing one. For example, if you have a file named local.env with this content:
204204

205205
```yaml
206-
type: Environment
206+
type: VariableSet
207207
spec:
208208
id: local.env
209209
name: local.env
@@ -215,9 +215,9 @@ spec:
215215
```
216216
217217
```sh
218-
tracetest run test -f path/to/test.yaml -e path/to/local.env
218+
tracetest run test -f path/to/test.yaml --vars path/to/local.env
219219
```
220220

221-
If you use the environment resource approach, a new environment will be created in Tracetest.
221+
If you use the variable set resource approach, a new variable set will be created in Tracetest.
222222

223223
The second approach is very useful if you are running tests from a CI pipeline.

docs/docs/cli/running-transactions.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@ tracetest run transaction -f path/to/transaction.yaml
2121
✔ Pokeshop - List (http://localhost:11633/test/QvPjBH_4g/run/4/test)
2222
```
2323

24-
## Running a Transaction That Uses Environment Variables
24+
## Running a Transaction That Uses Variable Sets
2525

26-
There are two ways of referencing an environment when running a transaction.
26+
There are two ways of referencing a variable set when running a transaction.
2727

28-
You can reference an existing environment using its id. For example, given this defined environment with an id of `'testenv'`:
28+
You can reference an existing variable set using its id. For example, given this defined variable set with an id of `'testenv'`:
2929

3030
![testenv](../img/show-environment-definition.png)
3131

32-
We can run a transaction and specify that environment with this command:
32+
We can run a transaction and specify that variable set with this command:
3333

3434
```sh
35-
tracetest run transaction -f path/to/transaction.yaml -e testenv
35+
tracetest run transaction -f path/to/transaction.yaml --vars testenv
3636
```
3737

38-
You can also reference an environment resource file which will be used to create a new environment or update an existing one. For example, if you have a file named `local.env` with this content:
38+
You can also reference a variable set resource file which will be used to create a new variable set or update an existing one. For example, if you have a file named `local.env` with this content:
3939

4040
```yaml
41-
type: Environment
41+
type: VariableSet
4242
spec:
4343
id: local.env
4444
name: local.env
@@ -50,9 +50,9 @@ spec:
5050
```
5151
5252
```sh
53-
tracetest run test -f path/to/transaction.yaml -e path/to/local.env
53+
tracetest run test -f path/to/transaction.yaml --vars path/to/local.env
5454
```
5555

56-
If you use the environment resource approach, a new environment will be created in Tracetest.
56+
If you use the variable set resource approach, a new variable set will be created in Tracetest.
5757

5858
The second approach is very useful if you are running tests from a CI pipeline.

docs/docs/cli/undefined-variables.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,29 @@ POKEID:
1313
POKENAME:
1414
```
1515

16-
Undefined variables are dependent on the environment selected and whether or not the variable is defined in the current environment. Select the environment to run the test or transaction by passing it into the test run command.
16+
Undefined variables are dependent on the variable set selected and whether or not the variable is defined in the current variable set. Select the variable set to run the test or transaction by passing it into the test run command.
1717

1818
```sh
19-
tracetest list environment
19+
tracetest list variableset
2020
```
2121

2222
```text title="Output:"
2323
ID NAME DESCRIPTION
2424
--------- --------- -------------
25-
testenv testenv testenv
25+
testvars testvars testvars
2626
```
2727

2828
```sh
29-
tracetest get environment --id testenv
29+
tracetest get variableset --id testvars
3030
```
3131

3232
```text title="Output:"
3333
---
34-
type: Environment
34+
type: VariableSet
3535
spec:
36-
id: testenv
37-
name: testenv
38-
description: testenv
36+
id: testvars
37+
name: testvars
38+
description: testvars
3939
values:
4040
- key: POKEID
4141
value: "42"
@@ -44,7 +44,7 @@ spec:
4444
```
4545

4646
```sh
47-
tracetest run test -f path/to/test.yaml -e testenv
47+
tracetest run test -f path/to/test.yaml --vars testvars
4848
```
4949

5050
```text title="Output:"

docs/docs/concepts/ad-hoc-testing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Ad-hoc Testing
22

3-
This page showcases use-cases for undefined variables and how to enable ad-hoc testing by utilizing environments and undefined variabled.
3+
This page showcases use-cases for undefined variables and how to enable ad-hoc testing by utilizing variable sets and undefined variables.
44

55
:::tip
66
[Check out how to configure ad-hoc testing with undefined variables with the **Web UI** here.](../web-ui/undefined-variables.md)
@@ -24,15 +24,15 @@ In Tracetest, undefined variables can be used in both the UI and CLI.
2424

2525
## **Undefined Variables Transaction with Multiple Tests Example**
2626

27-
1. Create an HTTP Pokemon list test that uses environment variables for hostname and the SKIP query parameter:
27+
1. Create an HTTP Pokemon list test that uses variables for hostname and the SKIP query parameter:
2828

2929
![Create Pokemon List](../img/pokeshop-list.png)
3030

31-
2. Within the test, create test spec assertions that use environment variables for comparators, something like: `http.status_code = "${env:STATUS_CODE}"`:
31+
1. Within the test, create test spec assertions that use variables for comparators, something like: `http.status_code = "${env:STATUS_CODE}"`:
3232

3333
![Create Test Spec Assertionsl](../img/create-test-spec-assertions.png)
3434

35-
3. Create a GRPC Pokemon add test that uses environment variables for hostname and Pokemon name:
35+
1. Create a GRPC Pokemon add test that uses variables for hostname and Pokemon name:
3636

3737
![Create GRPC](../img/create-grpc.png)
3838

docs/docs/concepts/environments.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

docs/docs/concepts/expressions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ attr:product.stock = attr:product.stok_before_purchase - attr:product.number_bou
3232

3333
### **String Interpolation**
3434

35-
Some tests might require strings to be compared, but maybe you need to generate a dynamic string that relies on a dynamic value. This might be used in an assertion or even in the request body referencing an environment variable.
35+
Some tests might require strings to be compared, but maybe you need to generate a dynamic string that relies on a dynamic value. This might be used in an assertion or even in the request body referencing a variable.
3636

3737
```css
3838
attr:error.message = "Could not withdraw ${attr:withdraw.amount}, your balance is insufficient."

docs/docs/concepts/transactions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ A transaction is defined as a group of steps that are executed in the defined or
99
The main benefit of using transactions is to chain tests together and use values obtained from a test in a subsequent test.
1010

1111
### How Values are Shared by Tests
12-
When a transaction is run, a context object is created with information about that specific run. One of those pieces of information is an `environment variables` object, which is empty by default. If the transaction is run when referencing an [environment](./environments), all values from the selected environments will be copied to the `environment variables` object.
12+
When a transaction is run, a context object is created with information about that specific run. One of those pieces of information is a `variable set` object, which is empty by default. If the transaction is run when referencing an [variable set](./variable-sets.md), all values from the selected variable sets will be copied to the `variable set` object.
1313

14-
When a test is executed within a transaction, if it generates any outputs, its outputs will be injected into the transaction context environment variables object. After the outputs are injected, all subsequent tests to be run within the transaction will be able to reference those values.
14+
When a test is executed within a transaction, if it generates any outputs, its outputs will be injected into the transaction context variable set object. After the outputs are injected, all subsequent tests to be run within the transaction will be able to reference those values.
1515

16-
> :information_source: Outputs generated by steps don't modify the selected [environment](./environments). It only modifies the transaction run context object.
16+
> :information_source: Outputs generated by steps don't modify the selected [variable set](./variable-sets.md). It only modifies the transaction run context object.
1717
18-
Consider you have 3 tests within a transaction: A, B, and C. Tests A and B generate outputs called A_OUTPUT and B_OUTPUT, respectively. When running the transaction, we provide an environment which contains a `HOST` environment variable. The execution of test A would only be able to reference `env:HOST`. B would be able to reference `env:HOST`, and `env:A_OUTPUT`. While C would be able to reference all three environment variables: `env:HOST`, `env:A_OUTPUT`, `env:B_OUTPUT`.
18+
Consider you have 3 tests within a transaction: A, B, and C. Tests A and B generate outputs called A_OUTPUT and B_OUTPUT, respectively. When running the transaction, we provide a variable set which contains a `HOST` variable. The execution of test A would only be able to reference `env:HOST`. B would be able to reference `env:HOST`, and `env:A_OUTPUT`. While C would be able to reference all three variables: `env:HOST`, `env:A_OUTPUT`, `env:B_OUTPUT`.
1919

2020
> :information_source: A single test can contain as many outputs as you like.
2121
@@ -29,7 +29,7 @@ outputs:
2929
expression: attr:tracetest.time.start
3030
```
3131
32-
This would create an output called `TIME_CANCEL_SUBSCRIPTION_MESSAGE_OBTAINED` that is obtained by reading the attribute `tracetest.time.start` from the span with `name` equal to `Process request from cancel subscription queue`. This value would would then be injected into the environment variables of that transaction to be accessed by other tests within the same transaction run.
32+
This would create an output called `TIME_CANCEL_SUBSCRIPTION_MESSAGE_OBTAINED` that is obtained by reading the attribute `tracetest.time.start` from the span with `name` equal to `Process request from cancel subscription queue`. This value would then be injected into the variables of that transaction to be accessed by other tests within the same transaction run.
3333

3434
### Transactions Execution Flow
3535

0 commit comments

Comments
 (0)