-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.4.8: Logs API, chaos examples, debugger port fix (#1609)
v0.4.8
- Loading branch information
Showing
16 changed files
with
584 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ CVE-2023-42319 # CWE-noinfo: lol... go-ethereum v1.13.8 again | |
CVE-2024-10086 # Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | ||
CVE-2024-51744 # CWE-755: Improper Handling of Exceptional Conditions | ||
CVE-2024-45338 # CWE-770: Allocation of Resources Without Limits or Throttling | ||
CVE-2024-45337 # CWE-863: Incorrect Authorization in golang.org/x/[email protected] | ||
CVE-2024-45337 # CWE-863: Incorrect Authorization in golang.org/x/[email protected] | ||
CVE-2025-24883 # CWE-248: Uncaught Exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Asserting Container Logs | ||
|
||
You can either assert that CL nodes have no errors like that, we check `(CRIT|PANIC|FATAL)` levels by default for all the nodes | ||
|
||
```golang | ||
in, err := framework.Load[Cfg](t) | ||
require.NoError(t, err) | ||
t.Cleanup(func() { | ||
err := framework.SaveAndCheckLogs(t) | ||
require.NoError(t, err) | ||
}) | ||
``` | ||
|
||
or customize file assertions | ||
|
||
```golang | ||
in, err := framework.Load[Cfg](t) | ||
require.NoError(t, err) | ||
t.Cleanup(func() { | ||
// save all the logs to default directory "logs/docker-$test_name" | ||
logs, err := framework.SaveContainerLogs(fmt.Sprintf("%s-%s", framework.DefaultCTFLogsDir, t.Name())) | ||
require.NoError(t, err) | ||
// check that CL nodes has no errors (CRIT|PANIC|FATAL) levels | ||
err = framework.CheckCLNodeContainerErrors() | ||
require.NoError(t, err) | ||
// do custom assertions | ||
for _, l := range logs { | ||
matches, err := framework.SearchLogFile(l, " name=HeadReporter version=\\d") | ||
require.NoError(t, err) | ||
_ = matches | ||
} | ||
}) | ||
``` | ||
|
||
Full [example](https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/framework/examples/myproject/smoke_logs_test.go) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Do not expose 40k ports by default, only with CTF_CLNODE_DLV flag | ||
- Remove default log checking API, make it simpler to customize, add docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package examples | ||
|
||
import ( | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/rpc" | ||
"github.com/stretchr/testify/require" | ||
"os" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestBlockchainChaos(t *testing.T) { | ||
srcChain := os.Getenv("CTF_CHAOS_SRC_CHAIN_RPC_HTTP_URL") | ||
require.NotEmpty(t, srcChain, "source chain RPC must be set") | ||
dstChain := os.Getenv("CTF_CHAOS_DST_CHAIN_RPC_HTTP_URL") | ||
require.NotEmpty(t, dstChain, "destination chain RPC must be set") | ||
|
||
recoveryIntervalDuration := 120 * time.Second | ||
|
||
testCases := []struct { | ||
name string | ||
chainURL string | ||
reorgDepth int | ||
}{ | ||
{ | ||
name: "Reorg src with depth: 1", | ||
chainURL: srcChain, | ||
reorgDepth: 1, | ||
}, | ||
{ | ||
name: "Reorg dst with depth: 1", | ||
chainURL: dstChain, | ||
reorgDepth: 1, | ||
}, | ||
{ | ||
name: "Reorg src with depth: 5", | ||
chainURL: srcChain, | ||
reorgDepth: 5, | ||
}, | ||
{ | ||
name: "Reorg dst with depth: 5", | ||
chainURL: dstChain, | ||
reorgDepth: 5, | ||
}, | ||
} | ||
|
||
// Run test cases | ||
for _, tc := range testCases { | ||
t.Run(tc.name, func(t *testing.T) { | ||
t.Log(tc.name) | ||
r := rpc.New(tc.chainURL, nil) | ||
err := r.GethSetHead(tc.reorgDepth) | ||
require.NoError(t, err) | ||
t.Logf("Awaiting chaos recovery: %s", tc.name) | ||
time.Sleep(recoveryIntervalDuration) | ||
|
||
// Validate Chainlink product here, use load test assertions | ||
}) | ||
} | ||
} |
Oops, something went wrong.