Skip to content

add cursing test#1976

Merged
makramkd merged 18 commits intomainfrom
mk/CCIP-10862
Apr 17, 2026
Merged

add cursing test#1976
makramkd merged 18 commits intomainfrom
mk/CCIP-10862

Conversation

@makramkd
Copy link
Copy Markdown
Collaborator

@makramkd makramkd commented Apr 14, 2026

Add a test that curses a source chain on the destination and asserts that the commit plugin doesn't commit those messages.

@makramkd makramkd changed the title bump chainlink-common bump chainlink-common, add cursing test Apr 16, 2026
Comment thread deployment/testadapters/adapters.go Outdated
Comment thread devenv/chainimpl/ccip-evm/impl.go Outdated
Comment thread devenv/tests/loki.go
//
// logQuery is the same log query that is used in the Grafana UI, e.g.
// `{container="don-node1"} | json | logger="SomeLoggerName" | msg="SomeMessage"`.
func WaitForLokiLogs(ctx context.Context, lokiWSURL, logQuery string) (string, error) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is basically a stripped down Loki log streamer compared to the logasserter package in chainlink-ccv. Eventually I think we should have a common library but this'll do for now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like this. In the past the options for assertions were really limited.

Comment thread devenv/go.mod
golang.org/x/sync v0.20.0
)

require github.com/gorilla/websocket v1.5.3
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Used for loki log streaming

@makramkd makramkd marked this pull request as ready for review April 17, 2026 09:10
@makramkd makramkd requested review from a team as code owners April 17, 2026 09:10
Comment thread devenv/tests/curse.go Outdated
winder
winder previously approved these changes Apr 17, 2026
Copy link
Copy Markdown
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

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

Amazing.

Comment thread devenv/tests/loki.go
// lokiPingQuery is a minimal valid LogQL selector for /tail. Loki rejects an empty `{}`
// selector (HTTP 400 before the WebSocket upgrade, seen as "bad handshake").
// Devenv pushes CCIP streams with a `job` label (see chainimpl monitoring).
const lokiPingQuery = `{job=~".+"}`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AFAIK we're moving away from loki, so this test has an expiration date

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Really? Even for development?

Comment thread devenv/tests/loki.go
//
// logQuery is the same log query that is used in the Grafana UI, e.g.
// `{container="don-node1"} | json | logger="SomeLoggerName" | msg="SomeMessage"`.
func WaitForLokiLogs(ctx context.Context, lokiWSURL, logQuery string) (string, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like this. In the past the options for assertions were really limited.

Comment thread devenv/tests/curse.go
// Ping the loki URL to ensure its available, else skip the test.
err := PingLoki(t.Context(), DefaultLokiURL)
if err != nil {
t.Skipf("failed to ping Loki WebSocket URL, is loki running?: %v", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How robust are these checks? Could we get into a situation where they're accidentally skipped and nobody knows about it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The ping part specifically? It seems to "work" based on the local testing I did (the ping fails if the loki API server is not up) but it may be different for real Loki deployments

Comment thread devenv/tests/curse.go Outdated
Comment thread deployment/testadapters/adapters.go Outdated
0xAustinWang
0xAustinWang previously approved these changes Apr 17, 2026
@makramkd makramkd dismissed stale reviews from winder and 0xAustinWang via c339282 April 17, 2026 17:04
Comment thread devenv/tests/curse.go
Comment on lines +40 to +44
curseAdapter, ok := fastcurse.GetCurseRegistry().GetCurseAdapter(destFamily, semver.MustParse("1.6.0"))
if !ok {
t.Skipf("no curse adapter registered for chain family: %s and version: %s", destFamily, semver.MustParse("1.6.0"))
}
require.NotNil(t, curseAdapter, "registered curse adapter is nil")
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No new interface needed, using the deployment API directly here.

Comment thread devenv/tests/curse.go
Comment on lines +68 to +79
output, err := curseCS.Apply(*e, fastcurse.RMNCurseConfig{
CurseActions: []fastcurse.CurseActionInput{
{
ChainSelector: toImpl.ChainSelector(),
SubjectChainSelector: fromImpl.ChainSelector(),
Version: semver.MustParse("1.6.0"),
IsGlobalCurse: false,
},
},
})
require.NoError(t, err)
require.Greater(t, len(output.Reports), 0)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Applying the changeset to curse.

Comment thread devenv/tests/curse.go Outdated
Comment thread devenv/tests/curse.go Outdated
@makramkd makramkd requested review from tt-cll and winder April 17, 2026 17:11
@makramkd makramkd changed the title bump chainlink-common, add cursing test add cursing test Apr 17, 2026
@makramkd makramkd enabled auto-merge April 17, 2026 18:39
@github-actions
Copy link
Copy Markdown

Metric mk/CCIP-10862 main
Coverage 70.1% 69.8%

@makramkd makramkd added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit 3963310 Apr 17, 2026
56 checks passed
@makramkd makramkd deleted the mk/CCIP-10862 branch April 17, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants