Skip to content

Commit c08144b

Browse files
committed
merge from main
2 parents 283d6a5 + 9e40f27 commit c08144b

File tree

8 files changed

+182
-163
lines changed

8 files changed

+182
-163
lines changed

framework/components/clnode/clnode.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ import (
55
"context"
66
"errors"
77
"fmt"
8-
"github.com/docker/docker/api/types/container"
9-
"github.com/docker/go-connections/nat"
10-
"github.com/smartcontractkit/chainlink-testing-framework/framework"
11-
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/postgres"
12-
tc "github.com/testcontainers/testcontainers-go"
13-
"github.com/testcontainers/testcontainers-go/wait"
148
"os"
159
"path/filepath"
1610
"strings"
1711
"sync"
1812
"text/template"
1913
"time"
14+
15+
"github.com/docker/docker/api/types/container"
16+
"github.com/docker/go-connections/nat"
17+
"github.com/smartcontractkit/chainlink-testing-framework/framework"
18+
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/postgres"
19+
tc "github.com/testcontainers/testcontainers-go"
20+
"github.com/testcontainers/testcontainers-go/wait"
2021
)
2122

2223
const (
@@ -164,10 +165,10 @@ func newNode(in *Input, pgOut *postgres.Output) (*NodeOut, error) {
164165
ctx := context.Background()
165166

166167
passwordPath, err := WriteTmpFile(DefaultPasswordTxt, "password.txt")
167-
apiCredentialsPath, err := WriteTmpFile(DefaultAPICredentials, "apicredentials")
168168
if err != nil {
169169
return nil, err
170170
}
171+
apiCredentialsPath, err := WriteTmpFile(DefaultAPICredentials, "apicredentials")
171172
if err != nil {
172173
return nil, err
173174
}

framework/components/clnode/clnode_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package clnode_test
22

33
import (
4+
"sync"
5+
"testing"
6+
47
"github.com/smartcontractkit/chainlink-testing-framework/framework"
58
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/clnode"
69
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/postgres"
710
"github.com/stretchr/testify/require"
8-
"sync"
9-
"testing"
1011
)
1112

1213
type testCase struct {

framework/components/clnode/connect_network.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package clnode
22

33
import (
44
"fmt"
5+
56
"github.com/google/uuid"
67
"github.com/smartcontractkit/chainlink-testing-framework/framework"
78
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"

framework/components/clnode/default.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Dynamic settings are usually used to connect Docker components together
88

99
const (
1010
DefaultTestKeystorePassword = "thispasswordislongenough"
11-
DefaultPasswordTxt = `T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ`
11+
DefaultPasswordTxt = `T.tLHkcmwePT/p,]sYuntjwHKAsrhm#4eRs4LuKHwvHejWYAC2JP4M8HimwgmbaZ` //nolint:gosec
1212
DefaultAPICredentials = `[email protected]
1313
fj293fbBnlQ!f9vNs`
1414
DefaultAPIUser = `[email protected]`
15-
DefaultAPIPassword = `fj293fbBnlQ!f9vNs`
15+
DefaultAPIPassword = `fj293fbBnlQ!f9vNs` //nolint:gosec
1616
)
1717

1818
const defaultConfigTmpl = `

tools/flakeguard/cmd/aggregate_results.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package cmd
22

33
import (
4+
"encoding/json"
45
"log"
6+
"os"
7+
"path/filepath"
58

69
"github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard/reports"
710
"github.com/spf13/cobra"
@@ -21,7 +24,31 @@ var AggregateResultsCmd = &cobra.Command{
2124
Use: "aggregate-results",
2225
Short: "Aggregate test results and optionally filter failed tests based on a threshold",
2326
RunE: func(cmd *cobra.Command, args []string) error {
24-
allReport, err := reports.AggregateTestResults(resultsFolderPath)
27+
// Read test reports from files
28+
var testReports []*reports.TestReport
29+
err := filepath.Walk(resultsFolderPath, func(path string, info os.FileInfo, err error) error {
30+
if err != nil {
31+
return err
32+
}
33+
if !info.IsDir() && filepath.Ext(path) == ".json" {
34+
// Read file content
35+
data, readErr := os.ReadFile(path)
36+
if readErr != nil {
37+
return readErr
38+
}
39+
var report *reports.TestReport
40+
if jsonErr := json.Unmarshal(data, &report); jsonErr != nil {
41+
return jsonErr
42+
}
43+
testReports = append(testReports, report)
44+
}
45+
return nil
46+
})
47+
if err != nil {
48+
log.Fatalf("Error reading test reports: %v", err)
49+
}
50+
51+
allReport, err := reports.Aggregate(testReports...)
2552
if err != nil {
2653
log.Fatalf("Error aggregating results: %v", err)
2754
}

tools/flakeguard/cmd/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var RunTestsCmd = &cobra.Command{
7171
// Print all failed tests including flaky tests
7272
if printFailedTests {
7373
fmt.Printf("PassRatio threshold for flaky tests: %.2f\n", maxPassRatio)
74-
reports.PrintTests(os.Stdout, testReport.Results, maxPassRatio, false)
74+
reports.PrintResults(os.Stdout, testReport.Results, maxPassRatio, false, false)
7575
}
7676

7777
// Save the test results in JSON format

0 commit comments

Comments
 (0)