Skip to content

Commit

Permalink
Lay groundwork for mocking and add initial workceptor unit tests (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronH88 authored Jun 28, 2023
1 parent 4addde8 commit 8d5dcca
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 8d5dcca

Please sign in to comment.