Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add readme for tests (#554) #555

Merged
merged 23 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ See `build.sh --help` for a full list of options and usage examples.

In the end, the build results in `kn` binary in your current directory, which can be directly executed.

**Testing:**

Please follow the [guide](./test) here to test the `knative client`.

**Notes:**

- For building, Go `1.11.4` is required [due to a go mod issue](https://github.com/golang/go/issues/27925).
Expand Down
66 changes: 66 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Test

This directory contains e2e tests and testing docs:

- Unit tests are in the code base alongside the code they test
- e2e tests are in [`test/e2e/`](./e2e)

## Running unit tests

To run all unit tests:

```bash
$ hack/build.sh -t
```

_By default `go test` will not run [the e2e tests](#running-e2e-tests-locally),
which need [`-tags=e2e`](#running-end-to-end-tests) to be enabled._

## Running e2e tests locally

To run [the e2e tests](./e2e) , you need to have a

1. [Running knative environment.](./../DEVELOPMENT.md#create-a-cluster)
2. `kn` binary in the $PATH.
3. Please Make sure that you are able to connect to the cluster by following the [guide here](./../docs#connecting-to-your-cluster)

Before running the e2e tests please make sure you dont have any namespaces with the name starting with `kne2etests`
itsmurugappan marked this conversation as resolved.
Show resolved Hide resolved

itsmurugappan marked this conversation as resolved.
Show resolved Hide resolved
Run all e2e tests:

```bash
$ test/e2e-tests-local.sh
```

### Running e2e tests selectively

To run only serving specific e2e tests locally, use

```bash
E2E_TAGS="serving" test/e2e-tests-local.sh
```

To run only eventing specific e2e tests locally, use

```bash
E2E_TAGS="eventing" test/e2e-tests-local.sh
```

itsmurugappan marked this conversation as resolved.
Show resolved Hide resolved
### Running a single test case

To run one e2e test case, e.g. TestBasicWorkflow

```bash
go test -v -tags=e2e -count=1 ./e2e -run ^TestBasicWorkflow$
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do this as suggested test/e2e-tests-local.sh -run ^TestBasicWorkflow$

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@navidshaikh thank you.
Instead of 'go test' use the script ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, see #555 (comment)

```

### Running tests in short mode

Running tests in short mode excludes some large-scale E2E tests and saves
time/resources required for running the test suite. To run the tests in short
mode, use
[the `-short` flag with `go test`](https://golang.org/cmd/go/#hdr-Testing_flags)

```bash
test/e2e-tests-local.sh -short
```