You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/user/unit-testing.md
+1-13Lines changed: 1 addition & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,6 @@
1
1
# Unit testing with Operator SDK
2
2
------------
3
3
4
-
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
5
-
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
6
-
**Table of Contents**<!-- *generated with [DocToc](https://github.com/thlorenz/doctoc)* -->
7
-
8
-
-[Overview](#overview)
9
-
-[Using a Fake client](#using-a-fake-client)
10
-
-[Testing Reconcile](#testing-reconcile)
11
-
-[Testing with 3rd Party Resources](#testing-with-3rd-party-resources)
12
-
-[How to increase the verbosity of the logs?](#how-to-increase-the-verbosity-of-the-logs)
13
-
14
-
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
15
-
16
4
## Overview
17
5
18
6
Testing your operator should involve both unit and [end-to-end][doc-e2e-test] tests. Unit tests assess the expected outcomes of individual operator components without requiring coordination between components. Operator unit tests should test multiple scenarios likely to be encountered by your custom operator logic at runtime. Much of your custom logic will involve API server calls via a [client][doc-client]; `Reconcile()` in particular will be making API calls on each reconciliation loop. These API calls can be mocked by using `controller-runtime`'s [fake client][doc-cr-fake-client], perfect for unit testing. This document steps through writing a unit test for the [memcached-operator][repo-memcached-reconcile]'s `Reconcile()` method using a fake client.
Copy file name to clipboardExpand all lines: website/content/en/docs/golang/unit-testing.md
+1-13Lines changed: 1 addition & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,6 @@ linkTitle: Unit Testing
4
4
weight: 10
5
5
---
6
6
7
-
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
8
-
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
9
-
**Table of Contents**<!-- *generated with [DocToc](https://github.com/thlorenz/doctoc)* -->
10
-
11
-
-[Overview](#overview)
12
-
-[Using a Fake client](#using-a-fake-client)
13
-
-[Testing Reconcile](#testing-reconcile)
14
-
-[Testing with 3rd Party Resources](#testing-with-3rd-party-resources)
15
-
-[How to increase the verbosity of the logs?](#how-to-increase-the-verbosity-of-the-logs)
16
-
17
-
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
18
-
19
7
## Overview
20
8
21
9
Testing your operator should involve both unit and [end-to-end][doc-e2e-test] tests. Unit tests assess the expected outcomes of individual operator components without requiring coordination between components. Operator unit tests should test multiple scenarios likely to be encountered by your custom operator logic at runtime. Much of your custom logic will involve API server calls via a [client][doc-client]; `Reconcile()` in particular will be making API calls on each reconciliation loop. These API calls can be mocked by using `controller-runtime`'s [fake client][doc-cr-fake-client], perfect for unit testing. This document steps through writing a unit test for the [memcached-operator][repo-memcached-reconcile]'s `Reconcile()` method using a fake client.
0 commit comments