Refactor interfaces to use a runner manager and an environment manager.
See https://gitlab.hpi.de/codeocean/codemoon/poseidon/-/issues/44.
This commit is contained in:
27
README.md
27
README.md
@ -105,8 +105,7 @@ $ make e2e-docker DOCKER_OPTS=""
|
||||
|
||||
### Mocks
|
||||
|
||||
For mocks we use [mockery](https://github.com/vektra/mockery). To generate a mock, first navigate to the package the interface is defined in.
|
||||
You can then create a mock for the interface of your choice by running
|
||||
For mocks we use [mockery](https://github.com/vektra/mockery). You can create a mock for the interface of your choice by running
|
||||
|
||||
```bash
|
||||
make mock name=INTERFACE_NAME pkg=./PATH/TO/PKG
|
||||
@ -120,4 +119,26 @@ For example, for an interface called `ExecutorApi` in the package `nomad`, you m
|
||||
make mock name=ExecutorApi pkg=./nomad
|
||||
```
|
||||
|
||||
If the interface changes, you can rerun this command.
|
||||
If the interface changes, you can rerun this command (deleting the mock file first to avoid errors may be necessary).
|
||||
|
||||
Mocks can also be generated by using mockery directly on a specific interface. To do this, first navigate to the package the interface is defined in. Then run
|
||||
|
||||
```bash
|
||||
mockery \
|
||||
--name=<<interface_name>> \
|
||||
--structname=<<interface_name>>Mock \
|
||||
--filename=<<interface_name>>Mock.go \
|
||||
--inpackage
|
||||
```
|
||||
|
||||
For example, for an interface called `ExecutorApi` in the package `nomad`, you might run
|
||||
|
||||
```bash
|
||||
mockery \
|
||||
--name=ExecutorApi \
|
||||
--structname=ExecutorApiMock \
|
||||
--filename=ExecutorApiMock.go \
|
||||
--inpackage
|
||||
```
|
||||
|
||||
Note that per default, the mocks are created in a `mocks` sub-folder. However, in some cases (if the mock implements private interface methods), it needs to be in the same package as the interface it is mocking. The `--inpackage` flag can be used to avoid creating it in a subdirectory.
|
||||
|
Reference in New Issue
Block a user