-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up CI integration tests (#516)
* Clean up CI integration tests * Remove job root dir in single app yaml * Fix issue * Add README to test * Fix typo
- Loading branch information
1 parent
06d20e1
commit 192d180
Showing
10 changed files
with
225 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# NVIDIA Flare Test | ||
|
||
|
||
This file introduces how the tests in NVIDIA FLARE is organized. | ||
|
||
We divide tests into unit test and integration test. | ||
|
||
```commandline | ||
tests: | ||
- unit_test | ||
- integration_test | ||
``` | ||
|
||
## Unit Tests | ||
|
||
### Structure | ||
|
||
The structure of unit test is organized as parallel directories of the production code. | ||
|
||
Each directory in `test/unit_test` is mapping to their counterparts in `nvflare`. | ||
|
||
For example, we have `test/unit_test/app_common/job_schedulers/job_scheduler.py` | ||
that tests `nvflare/app_common/job_schedulers/job_scheduler.py`. | ||
|
||
### Run | ||
|
||
To run unit test: `./runtest.sh`. | ||
|
||
### Develop a test case | ||
|
||
We use pytest to run our unit tests. | ||
So please follow pytest test case style. | ||
|
||
## Integration Tests | ||
|
||
Please refer to [integration tests README](./integration_test/README.md). | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# NVIDIA FLARE Integration test | ||
|
||
The integration tests entry file is `test/integration_test/system_test.py`. | ||
|
||
## Run | ||
|
||
First switch to this folder and then run | ||
|
||
`PYTHONPATH=[path/to/your/NVFlare] ./run_integration_tests.sh` | ||
|
||
|
||
## Test structure | ||
|
||
The main test will read test configurations from `./test_cases.yml`. | ||
|
||
### Test config | ||
|
||
Each test configuration yaml should contain the following attributes: | ||
|
||
| Attributes | Description | | ||
|---------------------|-------------------------------------------------------------| | ||
| `system_setup` | How to set up the system. (num of servers, clients) | | ||
| `single_app_as_job` | Whether the test cases are single app job or not. | | ||
| `cleanup` | Whether to clean up test folders or not. (Default to True.) | | ||
| `tests` | The test cases to run | | ||
|
||
If `single_app_as_job` is True, `apps_root_dir` is required. | ||
Otherwise, `jobs_root_dir` is required. | ||
|
||
### System setup config | ||
|
||
Each system setup configuration yaml should contain the following attribute: | ||
|
||
| Attributes | Description | | ||
|----------------|----------------------------------------------------------------------| | ||
| poc | Which poc folder to use (to get fed_server.json and fed_client.json) | | ||
| n_servers | number of servers | | ||
| n_clients | number of client sites | | ||
| snapshot_path | Where to store server snapshot. (needs to match what's inside poc) | | ||
| job_store_path | Where to store job information. (needs to match what's inside poc) | | ||
|
||
|
||
### Test cases | ||
|
||
Each test case has the following attributes: | ||
|
||
| Attributes | Description | | ||
|----------------------|----------------------------------------------------------------------------------------------| | ||
| app_name or job_name | testing app or job folder name. Note that these folders need to be inside the jobs_root_dir. | | ||
| validators | Which validator to use to validate the running result once the job is finished. | | ||
| event_sequence_yaml | What event sequence to run during each jobs. (HA test cases) | | ||
|
||
### Event sequence | ||
|
||
Each event sequence has the following attributes: | ||
|
||
| Attributes | Description | | ||
|-------------|----------------------------------------------| | ||
| description | Description of this specific event sequence. | | ||
| events | A list of events | | ||
|
||
Each event has the following attributes: | ||
|
||
| Attributes | Description | | ||
|--------------|--------------------------------------------------------| | ||
| trigger | When to perform the specified action. | | ||
| action | What actions to take if the trigger is triggered. | | ||
| result_state | What state to expect after these actions are finished. | | ||
|
||
Triggers can be triggered based on its type: | ||
- str: match a string based on log output from server | ||
- dict: state based on predefined tracked state variables | ||
(workflow, task, round_number, run_finished etc.) | ||
|
||
## Folder Structure | ||
|
||
- data: | ||
- apps: applications for testing | ||
- ha: ha test event sequence yaml files | ||
- single_app_as_job: test configuration for single app as job test cases | ||
- system: system setup config yaml files | ||
- tf2: TensorFlow2 related codes for the applications used in | ||
integration tests. | ||
- validators: Codes that implement the logic to validate the running result | ||
once the job is finished. | ||
|
||
### apps | ||
|
||
Because the applications inside the `apps` folder is treated as single app job. | ||
|
||
Each application in apps folder should contain `config` folder. | ||
|
||
And should have `config_fed_server.json` and `config_fed_client.json` inside the config folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
...s/integration_test/data/test_examples.yml → ...a/single_app_as_job/test_example_apps.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
tests/integration_test/data/test_ha.yml → ...n_test/data/single_app_as_job/test_ha.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
...s/integration_test/data/test_internal.yml → .../single_app_as_job/test_internal_apps.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
poc: ../../nvflare/poc | ||
n_servers: 1 | ||
n_clients: 2 | ||
snapshot_path: /tmp/snapshot-storage # need to match what's inside poc, TODO: auto generate | ||
job_store_path: /tmp/jobs-storage # need to match what's inside poc, TODO: auto generate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
poc: ../../nvflare/poc | ||
n_servers: 1 | ||
n_clients: 2 | ||
snapshot_path: /tmp/snapshot-storage # need to match what's inside poc, TODO: auto generate | ||
job_store_path: /tmp/jobs-storage # need to match what's inside poc, TODO: auto generate | ||
ha: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
test_configs: | ||
- ./data/single_app_as_job/test_example_apps.yml | ||
- ./data/single_app_as_job/test_internal_apps.yml | ||
- ./data/single_app_as_job/test_ha.yml |