... | @@ -4,6 +4,10 @@ goSDN is tested using unit and integration tests. To run all tests run `go test |
... | @@ -4,6 +4,10 @@ goSDN is tested using unit and integration tests. To run all tests run `go test |
|
|
|
|
|
The unit tests for the `nucleus` can be executed with `go test ./nucleus` from the repository root.
|
|
The unit tests for the `nucleus` can be executed with `go test ./nucleus` from the repository root.
|
|
|
|
|
|
|
|
Parallel execution of `Test_httpApi` and `TestRun` can cause a race condition if the `-race` flag is set. Thus `Test_httpApi` needs to be called [explicitly](#run-a-single-test).
|
|
|
|
|
|
|
|
Using the `-v`flag for more verbosity is recommended.
|
|
|
|
|
|
## Integration Tests
|
|
## Integration Tests
|
|
|
|
|
|
To run integration tests execute `go test ./test/integration`. Note that you have to be connected to the [VPN](https://its.h-da.io/infra-docs/docs/vpn.html) to access the default endpoints.
|
|
To run integration tests execute `go test ./test/integration`. Note that you have to be connected to the [VPN](https://its.h-da.io/infra-docs/docs/vpn.html) to access the default endpoints.
|
... | @@ -24,4 +28,20 @@ Set this environment variable to change the default gNMI user. Default is `admin |
... | @@ -24,4 +28,20 @@ Set this environment variable to change the default gNMI user. Default is `admin |
|
|
|
|
|
### `GOSDN_TEST_PASSWORD`
|
|
### `GOSDN_TEST_PASSWORD`
|
|
|
|
|
|
Set this environment variable to change the default gNMI user. Default is `arista` |
|
Set this environment variable to change the default gNMI user. Default is `arista`
|
|
\ No newline at end of file |
|
|
|
|
|
## Run a Single Test
|
|
|
|
|
|
|
|
If you want to run a single test you need to use the `-run` argument from within the test's directory.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
# Example to run `Test_httpApi`
|
|
|
|
cd nucleus
|
|
|
|
go test -run Test_httpApi
|
|
|
|
```
|
|
|
|
|
|
|
|
## Useful Resources
|
|
|
|
|
|
|
|
- [testing Package Documentation](https://golang.org/pkg/testing/)
|
|
|
|
- [Visualise Test Coverage](https://blog.golang.org/cover)
|
|
|
|
- [Go Race detection](https://blog.golang.org/race-detector) |
|
|
|
\ No newline at end of file |