Skip to content

Commit

Permalink
Rename integration tests to e2e tests
Browse files Browse the repository at this point in the history
Preparing ground for more changes down the line. Renaming integration to e2e will create space for actual integration tests. The Cucumber tests will be simplified to adhere to design principles of the framework and they'll serve the purpose of e2e tests. The more detailed testing will be moved to integration tests not written in Cucumber.
  • Loading branch information
jsliacan authored and praveenkumar committed Feb 3, 2021
1 parent 665d9cc commit 831aa62
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 31 deletions.
20 changes: 10 additions & 10 deletions Makefile
Expand Up @@ -77,7 +77,7 @@ vendorcheck:
./verify-vendor.sh

.PHONY: check
check: cross build_integration $(HOST_BUILD_DIR)/crc-embedder test cross-lint vendorcheck
check: cross build_e2e $(HOST_BUILD_DIR)/crc-embedder test cross-lint vendorcheck

# Start of the actual build targets

Expand Down Expand Up @@ -136,14 +136,14 @@ clean: clean_docs clean_macos_package
rm -f $(GOPATH)/bin/crc
rm -rf $(RELEASE_DIR)

.PHONY: build_integration
build_integration: $(SOURCES)
GOOS=linux go test ./test/integration/ -c -o $(BUILD_DIR)/linux-amd64/integration.test
GOOS=windows go test ./test/integration/ -c -o $(BUILD_DIR)/windows-amd64/integration.test.exe
GOOS=darwin go test ./test/integration/ -c -o $(BUILD_DIR)/macos-amd64/integration.test
.PHONY: build_e2e
build_e2e: $(SOURCES)
GOOS=linux go test ./test/e2e/ -c -o $(BUILD_DIR)/linux-amd64/e2e.test
GOOS=windows go test ./test/e2e/ -c -o $(BUILD_DIR)/windows-amd64/e2e.test.exe
GOOS=darwin go test ./test/e2e/ -c -o $(BUILD_DIR)/macos-amd64/e2e.test

.PHONY: integration ## Run integration tests
integration:
.PHONY: e2e ## Run e2e tests
e2e:
GODOG_OPTS = --godog.tags=$(GOOS)
ifndef PULL_SECRET_FILE
PULL_SECRET_FILE = --pull-secret-file=$(HOME)/Downloads/crc-pull-secret
Expand All @@ -154,8 +154,8 @@ endif
ifndef CRC_BINARY
CRC_BINARY = --crc-binary=$(GOPATH)/bin
endif
integration:
@go test --timeout=180m $(REPOPATH)/test/integration -v $(PULL_SECRET_FILE) $(BUNDLE_LOCATION) $(CRC_BINARY) --bundle-version=$(BUNDLE_VERSION) $(GODOG_OPTS)
e2e:
@go test --timeout=180m $(REPOPATH)/test/e2e -v $(PULL_SECRET_FILE) $(BUNDLE_LOCATION) $(CRC_BINARY) --bundle-version=$(BUNDLE_VERSION) $(GODOG_OPTS)

.PHONY: fmt
fmt:
Expand Down
8 changes: 4 additions & 4 deletions centos_ci.sh
Expand Up @@ -118,7 +118,7 @@ function upload_logs() {

# http://stackoverflow.com/a/22908437/1120530; Using --relative as --rsync-path not working
mkdir -p pr/$ghprbPullId/
cp -R test/integration/out/test-results/* pr/$ghprbPullId/
cp -R test/e2e/out/test-results/* pr/$ghprbPullId/
# Change the file permission to 0644 so after rsync it can be readable by other user.
chmod 0644 $HOME/.crc/crc.log
cp $HOME/.crc/crc.log pr/$ghprbPullId/crc_$(date '+%Y_%m_%d_%H_%M_%S').log
Expand All @@ -132,7 +132,7 @@ function run_tests() {
# this is copied over using https://github.com/minishift/minishift-ci-jobs/blob/master/minishift-ci-index.yaml#L99
export PULL_SECRET_FILE=--pull-secret-file=$HOME/payload/crc_pull_secret
export BUNDLE_LOCATION=--bundle-location=$HOME/Downloads/$BUNDLE
make integration
make e2e
if [[ $? -ne 0 ]]; then
upload_logs $1
exit 1
Expand All @@ -152,12 +152,12 @@ else
get_bundle
setup_golang

# setup to run integration tests
# setup to run e2e tests
cd payload
make
make check

# Retrieve password for rsync and run integration tests
# Retrieve password for rsync and run e2e tests
CICO_PASS=$(echo $CICO_API_KEY | cut -d'-' -f1-2)
run_tests $CICO_PASS
perform_artifacts_upload $CICO_PASS
Expand Down
30 changes: 15 additions & 15 deletions developing.adoc
Expand Up @@ -46,40 +46,40 @@ For more information, see the following:
. link:https://github.com/golang/go/wiki/Modules[Introduction to Go modules]
. link:https://blog.golang.org/using-go-modules[Using Go modules]

[[running-integration-tests]]
== Running integration tests
[[running-e2e-tests]]
== Running e2e tests

We have automated integration tests which keep CodeReady Containers in shape.
We have automated e2e tests which keep CodeReady Containers in shape.

[[intro-to-integration-testing]]
[[intro-to-e2e-testing]]
=== Introduction
Integration tests use the link:http://github.com/code-ready/clicumber[Clicumber] package to provide basic functionality for testing CLI binaries.
End-to-end (e2e) tests use the link:http://github.com/code-ready/clicumber[Clicumber] package to provide basic functionality for testing CLI binaries.

Clicumber allows running commands in a persistent shell instance (`bash`, `tcsh`, `zsh`, Command Prompt, or PowerShell), assert its outputs (standard output, standard error, or exit code), check configuration files, and so on. The general functionality of Clicumber is then extended by CodeReady Containers specific test code to cover the whole functionality of CodeReady Containers.

[[how-to-run-integration-tests]]
[[how-to-run-e2e-tests]]
=== How to run

First, one needs to set the following flags in `Makefile`, under `integration` target:
First, one needs to set the following flags in `Makefile`, under `e2e` target:

- `--pull-secret-file`: absolute path to your OpenShift pull secret.
- `--bundle-location`: if bundle is embedded, this flag should be set to `--bundle-location=embedded` or not passed at all; if bundle is not embedded, then absolute path to the bundle should be passed.
- `--crc-binary`: if `crc` binary resides in `$GOPATH/bin`, then this flag needs not be passed; otherwise absolute path to the `crc` binary should be passed.

To start integration tests, run:
To start e2e tests, run:
```bash
$ make integration
$ make e2e
```

===== How to run only a subset of all integration tests
===== How to run only a subset of all e2e tests

Implicitly, all integration tests for your operating system are executed. If you want to run only tests from one feature file, you have to override `GODOG_OPTS` environment variable. For example:
Implicitly, all e2e tests for your operating system are executed. If you want to run only tests from one feature file, you have to override `GODOG_OPTS` environment variable. For example:

```bash
make integration GODOG_OPTS="--godog.tags='@basic && @windows'" BUNDLE_LOCATION=<bundle location> PULL_SECRET_FILE=<pull secret path>
make e2e GODOG_OPTS="--godog.tags='@basic && @windows'" BUNDLE_LOCATION=<bundle location> PULL_SECRET_FILE=<pull secret path>
```

Please notice `@basic && @windows`, where `@basic` tag stands for `basic.feature` file and `@windows` tag for integration tests designed for Windows.
Please notice `@basic && @windows`, where `@basic` tag stands for `basic.feature` file and `@windows` tag for e2e tests designed for Windows.

[[how-to-test-cert-rotation]]
=== How to test cert rotation
Expand All @@ -100,7 +100,7 @@ $ CRC_DEBUG_ENABLE_STOP_NTP=true crc start
```


[[integration-test-logs]]
[[e2e-test-logs]]
=== Logs

Test logs can be found in [filename]`test/integration/out/test-results`.
Test logs can be found in [filename]`test/e2e/out/test-results`.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions test/integration/integration_test.go → test/e2e/e2e_test.go
@@ -1,12 +1,12 @@
package integration
package e2e

import (
"os"
"strings"
"testing"

"github.com/code-ready/clicumber/testsuite"
"github.com/code-ready/crc/test/integration/crcsuite"
"github.com/code-ready/crc/test/e2e/crcsuite"
"github.com/cucumber/godog"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 831aa62

Please sign in to comment.