Skip to content

Commit

Permalink
Add mocks and workceptor unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronH88 committed Jun 26, 2023
1 parent 4addde8 commit f92781b
Show file tree
Hide file tree
Showing 15 changed files with 1,099 additions and 77 deletions.
11 changes: 11 additions & 0 deletions docs/source/developer_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ Additionally, all code must pass a suite of Go linters. There is a pre-commit ya
See https://pre-commit.com/ and https://golangci-lint.run/ for more details on installing and using these tools.

We are using gomock to generate mocks for our unit tests. The mocks are living inside of a package under the real implementation, prefixed by mock_. An example is the package mock_workceptor under pkg/workceptor.

In order to genenerate a mock for a particular file, you can run:

.. code::
mockgen -source=pkg/filename.go -destination=pkg/mock_pkg/mock_filename.go
For example, to create/update mocks for Workceptor, we can run:

.. code::
mockgen -source=pkg/workceptor/workceptor.go -destination=pkg/workceptor/mock_workceptor/workceptor.go
Source code
^^^^^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/fsnotify/fsnotify v1.6.0
github.com/ghjm/cmdline v0.1.2
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang/mock v1.6.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/gorilla/websocket v1.5.0
github.com/jupp0r/go-priority-queue v0.0.0-20160601094913-ab1073853bde
Expand Down
200 changes: 200 additions & 0 deletions pkg/controlsvc/mock_controlsvc/interfaces.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 88 additions & 0 deletions pkg/framer/mock_framer/framer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f92781b

Please sign in to comment.