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

TT-1602 Add docs about E2E Github Workflows #14330

Merged
merged 13 commits into from
Sep 6, 2024
106 changes: 106 additions & 0 deletions .github/README.md
lukaszcl marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# E2E Tests on GitHub CI

E2E tests are executed on GitHub CI using the [E2E Tests Reusable Workflow](#about-the-reusable-workflow) or dedicated workflows.

## Automatic workflows

These workflows are designed to run automatically at crucial stages of the software development process, such as on every commit in a PR, nightly or before release.

### PR E2E Tests

Run on every commit in a PR to ensure changes do not introduce regressions.

Link: https://github.com/smartcontractkit/chainlink/blob/develop/.github/workflows/integration-tests.yml
lukaszcl marked this conversation as resolved.
Show resolved Hide resolved

### Nightly E2E Tests

Conducted nightly to catch issues that may develop over time or with accumulated changes.

Link: https://github.com/smartcontractkit/chainlink/blob/develop/.github/workflows/run-nightly-e2e-tests.yml

### Release E2E Tests

Currently, there are no automatic workflows triggering E2E tests at release. These tests are triggered on-demand by QA as needed.
lukaszcl marked this conversation as resolved.
Show resolved Hide resolved

## On-Demand Workflows

Triggered manually by QA for specific testing needs.

**Examples:**

- [On-Demand Automation Tests](https://github.com/smartcontractkit/chainlink/actions/workflows/automation-ondemand-tests.yml)
- [CCIP Chaos Tests](https://github.com/smartcontractkit/chainlink/actions/workflows/ccip-chaos-tests.yml)
- [OCR Soak Tests](https://github.com/smartcontractkit/chainlink/actions/workflows/on-demand-ocr-soak-test.yml)
- [VRFv2Plus Smoke Tests](https://github.com/smartcontractkit/chainlink/actions/workflows/on-demand-vrfv2plus-smoke-tests.yml)

## Test Configs
lukaszcl marked this conversation as resolved.
Show resolved Hide resolved

E2E tests utilize TOML files to define their parameters. Each test is equipped with a default TOML config, which can be overridden by specifying an alternative TOML config. This allows for running tests with varied parameters, such as on a non-default blockchain network. For tests executed on GitHub CI, both the default configs and any override configs must reside within the git repository. The `test_config_override_path` workflow input is used to provide a path to an override config.
lukaszcl marked this conversation as resolved.
Show resolved Hide resolved

**Important Note:** The use of `base64Config` input is deprecated in favor of `test_config_override_path`. For more details, refer to [the decision log](https://smartcontract-it.atlassian.net/wiki/spaces/TT/pages/927596563/Storing+All+Test+Configs+In+Git).

## Test Secrets

For security reasons, test secrets and sensitive information are not stored directly within the test config TOML files. Instead, these secrets are securely injected into tests using environment variables. For a detailed explanation on managing test secrets, refer to our [Test Secrets documentation](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/config/README.md#test-secrets).

If you need to run a GitHub workflow using custom secrets, please refer to the [guide on running GitHub workflows with your test secrets](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/config/README.md#run-github-workflow-with-your-test-secrets).

## About the Reusable Workflow

The [E2E Tests Reusable Workflow](https://github.com/smartcontractkit/chainlink/blob/develop/.github/workflows/run-e2e-tests-reusable-workflow.yml) is designed to run any type of E2E test on GitHub CI, including docker/testcontainers, old K8s tests, or tests in CRIB in the future.

Our goal is to migrate all workflows to use this reusable workflow for executing E2E tests. This approach will streamline our CI and allow for the automatic execution of tests at different stages of the software development process. Learn more about the advantages of using reusable workflows [here](https://smartcontract-it.atlassian.net/wiki/spaces/TT/pages/815497220/CI+Workflows+for+E2E+Tests).

**Examples of Workflows Utilizing the Reusable Workflow:**

- [Integration Tests](https://github.com/smartcontractkit/chainlink/blob/develop/.github/workflows/integration-tests.yml)
- [Nightly E2E Tests](https://github.com/smartcontractkit/chainlink/blob/develop/.github/workflows/run-nightly-e2e-tests.yml)
- [Selected E2E Tests](https://github.com/smartcontractkit/chainlink/blob/develop/.github/workflows/run-selected-e2e-tests.yml)
- [On-Demand Automation Tests](https://github.com/smartcontractkit/chainlink/blob/develop/.github/workflows/automation-ondemand-tests.yml)
- [CCIP Chaos Tests](https://github.com/smartcontractkit/chainlink/blob/develop/.github/workflows/ccip-chaos-tests.yml)

### E2E Test Configuration on GitHub CI

The [e2e-tests.yml](https://github.com/smartcontractkit/chainlink/blob/develop/.github/e2e-tests.yml) file lists all E2E tests configured for execution on CI. Each entry specifies the type of GitHub Runner needed and the workflows in which the test is included (for example, `smoke/ocr_test.go:*` is executed both in PRs and nightly).
lukaszcl marked this conversation as resolved.
Show resolved Hide resolved

### Slack Notification After Tests
lukaszcl marked this conversation as resolved.
Show resolved Hide resolved

To configure Slack notifications after tests executed via the reusable workflow, follow these steps:

- Set `slack_notification_after_tests` to either `always` or `on_failure` depending on when you want notifications to be sent.
- Assign `slack_notification_after_tests_channel_id` to the ID of the Slack channel where notifications should be sent.
- Provide a title for the notification by setting `slack_notification_after_tests_name`.

**Example:**

```
jobs:
call-run-e2e-tests-workflow:
name: Run E2E Tests
uses: ./.github/workflows/run-e2e-tests-reusable-workflow.yml
with:
chainlink_version: develop
test_workflow: Nightly E2E Tests
slack_notification_after_tests: true
slack_notification_after_tests_channel_id: "#team-test-tooling-internal"
slack_notification_after_tests_name: Nightly E2E Tests
```

## Guides

### How to Run Selected Tests on GitHub CI

The [Run Selected E2E Tests Workflow](https://github.com/smartcontractkit/chainlink/actions/workflows/run-selected-e2e-tests.yml) allows you to execute specific E2E tests as defined in the [e2e-tests.yml](https://github.com/smartcontractkit/chainlink/blob/develop/.github/e2e-tests.yml). This is useful for various purposes such as testing specific features on a particular branch or verifying that modifications to a test have not introduced any issues.

For details on all available inputs that the workflow supports, refer to the [workflow definition](https://github.com/smartcontractkit/chainlink/actions/workflows/run-selected-e2e-tests.yml).

**Example Usage:**

To run a set of VRFv2Plus tests from a custom branch, use the following command:

```bash
gh workflow run run-selected-e2e-tests.yml \
-f test_ids="TestVRFv2Plus_LinkBilling,TestVRFv2Plus_NativeBilling,TestVRFv2Plus_DirectFunding,TestVRFV2PlusWithBHS" \
-f chainlink_version=develop \
--ref TT-1550-Provide-PoC-for-keeping-test-configs-in-git
```
Loading