Skip to content

Commit ef02813

Browse files
authored
Merge branch 'main' into flakeguardAggregations
2 parents ca3ce88 + b6c2cd2 commit ef02813

File tree

54 files changed

+931
-216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+931
-216
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Generate go-docs
2+
3+
on:
4+
pull_request:
5+
types:
6+
- labeled
7+
- reopened
8+
- synchronize
9+
10+
jobs:
11+
generate_docs_new_pr:
12+
if: ${{ contains(github.event.issue.labels.*.name, 'generate_go_docs') }}
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
repository-projects: read
18+
19+
steps:
20+
- name: Checkout current branch
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup Git
26+
run: |
27+
git config user.name "github-actions[bot]"
28+
git config user.email "github-actions[bot]@users.noreply.github.com"
29+
30+
- name: Get PR details
31+
id: pr-details
32+
run: |
33+
echo "pr_number=$(jq -r .pull_request.number <<< "$GITHUB_EVENT_PATH")" >> $GITHUB_OUTPUT
34+
echo "pr_branch=$(jq -r .pull_request.head.ref <<< "$GITHUB_EVENT_PATH")" >> $GITHUB_OUTPUT
35+
echo "base_commit=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT
36+
echo "head_commit=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
37+
38+
- name: Install go doc generator
39+
shell: bash
40+
run: |
41+
go install github.com/smartcontractkit/generate-go-function-docs@latest
42+
43+
- name: Install gopls
44+
shell: bash
45+
run: |
46+
go install golang.org/x/tools/gopls@latest
47+
48+
- name: Create a new branch
49+
run: |
50+
git checkout -b ${{ steps.pr-details.outputs.pr_branch }}-docs
51+
52+
- name: Generate go docs
53+
shell: bash
54+
env:
55+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
56+
run: |
57+
generate-go-function-docs diff -b ${{ steps.pr-details.outputs.base_commit }} -c ${{ steps.pr-details.outputs.head_commit }} -g fake_slash
58+
59+
- name: Make sure code still compiles
60+
run: |
61+
go mod tidy
62+
go mod vendor
63+
go build ./...
64+
65+
- name: Commit changes
66+
run: |
67+
git add .
68+
git commit -m "Add automatically generated go documentation"
69+
git push origin ${{ steps.pr-details.outputs.pr_branch }}-docs
70+
71+
- name: Create a new PR targeting current PR
72+
uses: peter-evans/create-pull-request@v5
73+
with:
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
base: ${{ env.pr_branch }}
76+
branch: ${{ steps.pr-details.outputs.pr_branch }}-docs
77+
title: "Go docs for PR#${{ env.pr_number }}"
78+
body: "This PR contains automatically generated go documentation for the PR#${{ env.pr_number }}. Please review the changes."

.github/workflows/k8s-publish-test-base-image.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
# we only need base image for k8s based tests
66
- 'lib/v*'
77
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag for the base image'
11+
required: true
12+
type: string
813

914
jobs:
1015
publish_test_base_image:
@@ -19,12 +24,20 @@ jobs:
1924
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
2025

2126
- name: Strip "lib/" from github.ref_name
27+
if: ${{ github.event_name == 'push' }}
2228
run: |
2329
stripped_ref_name="${GITHUB_REF//refs\/tags\/lib\//}"
2430
# disabling as the string containing variable is double-quotted as a whole, no need to quote each variable separately
2531
# shellcheck disable=SC2086
2632
echo "BASE_IMAGE_TAG=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image:$stripped_ref_name" >> $GITHUB_ENV
2733
34+
- name: Export base image tag for workflow dispatch
35+
if: ${{ github.event_name == 'workflow_dispatch' }}
36+
shell: bash
37+
run: |
38+
# shellcheck disable=SC2086
39+
echo "BASE_IMAGE_TAG=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/test-base-image:${{ github.event.inputs.tag }}" >> $GITHUB_ENV
40+
2841
- name: Build Base Image
2942
uses: smartcontractkit/chainlink-github-actions/docker/build-push@d2f9642bcc24a73400568756f24b72c188ac7a9a # v2.3.31
3043
with:

book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- [Mocking Services](framework/components/mocking.md)
2424
- [Copying Files](framework/copying_files.md)
2525
- [External Environment](framework/components/external.md)
26+
- [Troubleshooting](framework/components/troubleshooting.md)
2627
- [Secrets]()
2728
- [Observability Stack](framework/observability/observability_stack.md)
2829
- [Metrics](framework/observability/metrics.md)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Troubleshooting
2+
3+
## Can't run `anvil`, issue with `Rosetta`
4+
```
5+
2024/11/27 15:20:27 ⏳ Waiting for container id 79f8a68c07cc image: f4hrenh9it/foundry:latest. Waiting for: &{Port:8546 timeout:0x14000901278 PollInterval:100ms skipInternalCheck:false}
6+
2024/11/27 15:20:27 container logs (all exposed ports, [8546/tcp], were not mapped in 5s: port 8546/tcp is not mapped yet
7+
wait until ready: check target: retries: 1, port: "", last err: container exited with code 133):
8+
rosetta error: Rosetta is only intended to run on Apple Silicon with a macOS host using Virtualization.framework with Rosetta mode enabled
9+
```
10+
#### Solution
11+
12+
Update your docker to `Docker version 27.3.1, build ce12230`

book/src/framework/getting_started.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
- `Docker` [OrbStack](https://orbstack.dev/) or [Docker Desktop](https://www.docker.com/products/docker-desktop/), we recommend OrbStack (faster, smaller memory footprint)
55
- [Golang](https://go.dev/doc/install)
66

7+
Tested with
8+
```
9+
Docker version 27.3.1
10+
OrbStack Version: 1.8.2 (1080200)
11+
```
12+
713
## Test setup
814

915
To start writing tests create a directory for your project with `go.mod` and add a package

book/src/framework/observability/blockscout.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ To remove it, we also clean up all Blockscout databases to prevent stale data wh
1212
ctf bs down
1313
```
1414

15+
## Selecting Blockchain Node
16+
17+
By default, we connect to the first `anvil` node, but you can select the node explicitly
18+
```
19+
ctf bs -r http://host.docker.internal:8545 d
20+
ctf bs -r http://host.docker.internal:8555 d
21+
```
22+
1523
<div class="warning">
1624

1725
Blockscout isn’t ideal for local, ephemeral environments, as it won’t re-index blocks and transactions on test reruns. The easiest approach is to set up Blockscout first, initialize the test environment, switch to the [cache](../components/caching.md) config, and run tests without restarting RPC nodes.

book/src/k8s-test-runner/k8s-test-runner.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The TOML config should specify the test runner configuration as follows:
4545
```
4646
namespace = "e2e-tests"
4747
rbac_role_name = "" # RBAC role name for the chart
48+
rbac_service_account_name = "" # RBAC service account name for the chart
4849
image_registry_url = "" # URL to the ECR containing the test binary image, e.g., staging ECR URL
4950
image_name = "k8s-test-runner"
5051
image_tag = "" # The image tag to use, like "mercury-load-tests" (see readme above)
@@ -61,8 +62,16 @@ resources_limits_memory = "1024Mi"
6162
WASP_LOG_LEVEL = "info"
6263
TEST_LOG_LEVEL = "info"
6364
MERCURY_TEST_LOG_LEVEL = "info"
65+
[metadata.labels]
66+
"chain.link/component" = "test-runner"
67+
"chain.link/product" = "<your-product-name>"
68+
"chain.link/team" = "<name–of-the-team-you're-running-the-test-for>"
69+
"chain.link/cost-center" = "test-tooling-<testType>-test"
6470
```
6571

72+
> [NOTE]
73+
> Make sure to quote labels with "/" as otherwise parsing them will fail.
74+
6675
Where:
6776

6877
- `test_name` is the name of the test to run (must be included in the test binary).
@@ -113,6 +122,7 @@ Then:
113122
cat << EOF > config.toml
114123
namespace = "e2e-tests"
115124
rbac_role_name = "" # RBAC role name for the chart
125+
rbac_service_account_name = "" # RBAC service account name for the chart
116126
image_registry_url = "${{ secrets.AWS_ACCOUNT_ID_STAGING }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com"
117127
image_name = "k8s-test-runner"
118128
image_tag = "mercury-load-test"
@@ -130,6 +140,11 @@ Then:
130140
WASP_LOG_LEVEL = "info"
131141
TEST_LOG_LEVEL = "info"
132142
MERCURY_TEST_LOG_LEVEL = "info"
143+
[metadata.labels]
144+
"chain.link/component" = "test-runner"
145+
"chain.link/product" = "data-streamsv0.3"
146+
"chain.link/team" = "Data Streams"
147+
"chain.link/cost-center" = "test-tooling-load-test"
133148
EOF
134149
135150
./k8s-test-runner-linux-amd64 run -c config.toml

framework/.changeset/v0.2.12.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Omit all local tooling container logs
2+
- Allow to connect Blockscout to any node

framework/.changeset/v0.2.13.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Simplify local Chainlink build
2+
- Remove dependency on "local-registry"
3+
- Skip Promtail to accelerate CI 🚀

framework/cmd/blockscout.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ package main
33
import (
44
"fmt"
55
"github.com/smartcontractkit/chainlink-testing-framework/framework"
6+
"os"
67
"path/filepath"
78
)
89

9-
func blockscoutUp() error {
10+
func blockscoutUp(url string) error {
1011
framework.L.Info().Msg("Creating local Blockscout stack")
1112
if err := extractAllFiles("observability"); err != nil {
1213
return err
1314
}
15+
os.Setenv("BLOCKSCOUT_RPC_URL", url)
1416
err := runCommand("bash", "-c", fmt.Sprintf(`
1517
cd %s && \
1618
docker compose up -d
@@ -23,8 +25,9 @@ func blockscoutUp() error {
2325
return nil
2426
}
2527

26-
func blockscoutDown() error {
28+
func blockscoutDown(url string) error {
2729
framework.L.Info().Msg("Removing local Blockscout stack")
30+
os.Setenv("BLOCKSCOUT_RPC_URL", url)
2831
err := runCommand("bash", "-c", fmt.Sprintf(`
2932
cd %s && \
3033
docker compose down -v

0 commit comments

Comments
 (0)