1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 06:46:26 +01:00
Files
openshift-docs/modules/osdk-cli-reference-test.adoc
2020-12-10 09:14:15 -07:00

68 lines
1.7 KiB
Plaintext

// Module included in the following assemblies:
//
// * operators/operator_sdk/osdk-cli-reference.adoc
[id="osdk-cli-reference-test_{context}"]
= test
The `operator-sdk test` command can test the Operator locally.
== local
The `local` subcommand runs Go tests built using the test framework of the Operator SDK locally.
.`test local` arguments
[options="header",cols="1,3"]
|===
|Arguments |Description
|`<test_location>` (string)
|Location of end-to-end (e2e) test files, for example `./test/e2e/`.
|===
.`test local` flags
[options="header",cols="1,3"]
|===
|Flags |Description
|`--kubeconfig` (string)
|Location of `kubeconfig` for a cluster. Default: `~/.kube/config`.
|`--global-manifest` (string)
|Path to manifest for global resources. Default: `deploy/crd.yaml`.
|`--namespaced-manifest` (string)
|Path to manifest for per-test, namespaced resources. Default: combines `deploy/service_account.yaml`, `deploy/rbac.yaml`, and `deploy/operator.yaml`.
|`--namespace` (string)
|If non-empty, a single namespace to run tests in, for example `operator-test`. Default: `""`.
|`--go-test-flags` (string)
|Extra arguments to pass to `go test`, for example `-f "-v -parallel=2"`.
|`--up-local`
|Enable running the Operator locally with `go run` instead of as an image in the cluster.
|`--no-setup`
|Disable test resource creation.
|`--image` (string)
|Use a different Operator image from the one specified in the namespaced manifest.
|`-h, --help`
|Usage help output.
|===
For example:
[source,terminal]
----
$ operator-sdk test local ./test/e2e/
----
.Example output
[source,terminal]
----
ok github.com/operator-framework/operator-sdk-samples/memcached-operator/test/e2e 20.410s
----