You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sdk/core/azure_core_test/src/perf/README.md
+11-52Lines changed: 11 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,12 @@ Each performance test has the following standardized parameters:
25
25
26
26
Each test has its own set of parameters which are specific to the test.
27
27
28
+
***NOTE: Performance Tests are "recorded" tests***
29
+
30
+
This means that they follow the same rules as tests annotated with the `#[recorded::test]` attribute. There is one difference between perf tests and tests with the `recorded::test` attribute: perf tests default to `live` mode, and normal `recorded::test` tests default to `playback` mode.
31
+
32
+
To configure the tests for record mode tests, set `AZURE_TEST_MODE` to `record` before running your performance tests, and to run your tests using the test proxy, set `AZURE_TEST_MODE` to `playback`
33
+
28
34
## Test authoring
29
35
30
36
Performance tests have three phases:
@@ -43,64 +49,17 @@ A perf test has a name (`get_secret`, `list_blobs`, `upload_blob`, etc), a short
43
49
44
50
Each perf test also has a set of command line options that are specific to the individual test, these are defined by a `PerfTestOptions` structure. It contains fields like help text for the option, activators
45
51
46
-
Here is an example of test metadata for a performance test:
47
-
48
-
```rust
49
-
PerfTestMetadata {
50
-
name:"get_secret",
51
-
description:"Get a secret from Key Vault",
52
-
options:vec![PerfTestOption {
53
-
name:"vault_url",
54
-
display_message:"The URL of the Key Vault to use in the test",
55
-
mandatory:true,
56
-
short_activator:'u',
57
-
long_activator:"vault-url",
58
-
expected_args_len:1,
59
-
..Default::default()
60
-
}],
61
-
create_test:Self::create_new_test,
62
-
}
63
-
```
52
+
An example of perf test metadata [can be found here](https://github.com/Azure/azure-sdk-for-rust/blob/e47a38f93e7ac2797754c103da7fe8b177e46365/sdk/keyvault/azure_security_keyvault_keys/perf/create_key.rs#L26C1-L41C1)
64
53
65
-
This defines a test named `get_secret` with a single required "vault_url" option.
66
-
67
-
For this test, the `create_new_test` function looks like:
This defines a test named `create_key` with a single required "vault_url" option.
55
+
56
+
An example of the `create_new_test` function [can be found here](https://github.com/Azure/azure-sdk-for-rust/blob/e47a38f93e7ac2797754c103da7fe8b177e46365/sdk/keyvault/azure_security_keyvault_keys/perf/get_key.rs#L42-L58)
85
57
86
58
### Test invocation
87
59
88
60
The final piece of code which is necessary to run the performance tests is logic to hook up the tests with a test runner.
89
61
90
-
```rust
91
-
#[tokio::main]
92
-
asyncfnmain() ->azure_core::Result<()> {
93
-
letrunner=PerfRunner::new(
94
-
env!("CARGO_MANIFEST_DIR"),
95
-
file!(),
96
-
vec![GetSecrets::test_metadata()],
97
-
)?;
98
-
99
-
runner.run().await?;
100
-
101
-
Ok(())
102
-
}
103
-
```
62
+
An example of this, from the Keyvault Keys performance tests [can be found here](https://github.com/Azure/azure-sdk-for-rust/blob/e47a38f93e7ac2797754c103da7fe8b177e46365/sdk/keyvault/azure_security_keyvault_keys/perf/perf_tests.rs#L24-L35)
104
63
105
64
This declares a perf test runner with a set of defined test metadata and runs the performance test. If your performance test suite has more than one performance test, then it should be added to the final parameter to the `PerfRunner::new()` function.
0 commit comments