Skip to content

Commit 49fbb63

Browse files
committed
v0.4.2
1 parent cfdeeab commit 49fbb63

File tree

9 files changed

+83
-28
lines changed

9 files changed

+83
-28
lines changed

framework/.changeset/v0.4.2.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Name logs subdir as test name
2+
- Mutex for concurrent mock Record access
3+
- Remove Promtail only through CLI

framework/cmd/observability.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func observabilityDown() error {
3030
framework.L.Info().Msg("Removing local observability stack")
3131
err := runCommand("bash", "-c", fmt.Sprintf(`
3232
cd %s && \
33-
docker compose down -v
33+
docker compose down -v && docker rm -f promtail
3434
`, "compose"))
3535
if err != nil {
3636
return err

framework/components/simple_node_set/reload.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import (
66
"github.com/smartcontractkit/chainlink-testing-framework/framework"
77
"github.com/smartcontractkit/chainlink-testing-framework/framework/chaos"
88
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
9+
"testing"
910
"time"
1011
)
1112

1213
// UpgradeNodeSet updates nodes configuration TOML files
1314
// this API is discouraged, however, you can use it if nodes require restart or configuration updates, temporarily!
14-
func UpgradeNodeSet(in *Input, bc *blockchain.Output, wait time.Duration) (*Output, error) {
15-
uniq := fmt.Sprintf("%s-%s", framework.DefaultCTFLogsDir, uuid.NewString()[0:4])
15+
func UpgradeNodeSet(t *testing.T, in *Input, bc *blockchain.Output, wait time.Duration) (*Output, error) {
16+
uniq := fmt.Sprintf("%s-%s-%s", framework.DefaultCTFLogsDir, t.Name(), uuid.NewString()[0:4])
1617
if err := framework.WriteAllContainersLogs(uniq); err != nil {
1718
return nil, err
1819
}

framework/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func Load[X any](t *testing.T) (*X, error) {
130130
t.Cleanup(func() {
131131
err := Store[X](input)
132132
require.NoError(t, err)
133-
err = WriteAllContainersLogs(DefaultCTFLogsDir)
133+
err = WriteAllContainersLogs(fmt.Sprintf("%s-%s", DefaultCTFLogsDir, t.Name()))
134134
require.NoError(t, err)
135135
err = checkAllNodeLogErrors()
136136
require.NoError(t, err)

framework/docker.go

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"encoding/binary"
88
"fmt"
99
"github.com/docker/docker/api/types/container"
10+
filters2 "github.com/docker/docker/api/types/filters"
1011
"github.com/docker/docker/client"
1112
"github.com/docker/go-connections/nat"
1213
"github.com/google/uuid"
@@ -175,23 +176,6 @@ func (dc *DockerClient) copyToContainer(containerID, sourceFile, targetPath stri
175176
return nil
176177
}
177178

178-
func in(s string, substrings []string) bool {
179-
for _, substr := range substrings {
180-
if strings.Contains(s, substr) {
181-
return true
182-
}
183-
}
184-
return false
185-
}
186-
187-
func isLocalToolDockerContainer(containerName string) bool {
188-
if in(containerName, []string{"/sig-provider", "/stats", "/stats-db", "/db", "/backend", "/promtail", "/compose", "/blockscout", "/frontend", "/user-ops-indexer", "/visualizer", "/redis-db", "/proxy"}) {
189-
L.Debug().Str("Container", containerName).Msg("Ignoring local tool container output")
190-
return true
191-
}
192-
return false
193-
}
194-
195179
// WriteAllContainersLogs writes all Docker container logs to the default logs directory
196180
func WriteAllContainersLogs(dir string) error {
197181
L.Info().Msg("Writing Docker containers logs")
@@ -204,7 +188,13 @@ func WriteAllContainersLogs(dir string) error {
204188
if err != nil {
205189
return fmt.Errorf("failed to create Docker provider: %w", err)
206190
}
207-
containers, err := provider.Client().ContainerList(context.Background(), container.ListOptions{All: true})
191+
containers, err := provider.Client().ContainerList(context.Background(), container.ListOptions{
192+
All: true,
193+
Filters: filters2.NewArgs(filters2.KeyValuePair{
194+
Key: "label",
195+
Value: "framework=ctf",
196+
}),
197+
})
208198
if err != nil {
209199
return fmt.Errorf("failed to list Docker containers: %w", err)
210200
}
@@ -214,9 +204,6 @@ func WriteAllContainersLogs(dir string) error {
214204
for _, containerInfo := range containers {
215205
eg.Go(func() error {
216206
containerName := containerInfo.Names[0]
217-
if isLocalToolDockerContainer(containerName) {
218-
return nil
219-
}
220207
L.Debug().Str("Container", containerName).Msg("Collecting logs")
221208
logOptions := container.LogsOptions{ShowStdout: true, ShowStderr: true}
222209
logs, err := provider.Client().ContainerLogs(context.Background(), containerInfo.ID, logOptions)

framework/examples/myproject/go.mod

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/blocto/solana-go-sdk v1.30.0
1414
github.com/ethereum/go-ethereum v1.14.11
1515
github.com/go-resty/resty/v2 v2.15.3
16-
github.com/smartcontractkit/chainlink-testing-framework/framework v0.0.0-00010101000000-000000000000
16+
github.com/smartcontractkit/chainlink-testing-framework/framework v0.4.1
1717
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.10
1818
github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2
1919
github.com/stretchr/testify v1.10.0
@@ -35,6 +35,7 @@ require (
3535
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
3636
github.com/armon/go-metrics v0.4.1 // indirect
3737
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
38+
github.com/atotto/clipboard v0.1.4 // indirect
3839
github.com/avast/retry-go v3.0.0+incompatible // indirect
3940
github.com/awalterschulze/gographviz v2.0.3+incompatible // indirect
4041
github.com/aws/aws-sdk-go v1.45.25 // indirect
@@ -52,6 +53,7 @@ require (
5253
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4 // indirect
5354
github.com/aws/aws-sdk-go-v2/service/sts v1.33.0 // indirect
5455
github.com/aws/smithy-go v1.22.1 // indirect
56+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
5557
github.com/benbjohnson/clock v1.3.5 // indirect
5658
github.com/beorn7/perks v1.0.1 // indirect
5759
github.com/bits-and-blooms/bitset v1.13.0 // indirect
@@ -60,9 +62,18 @@ require (
6062
github.com/bytedance/sonic v1.12.3 // indirect
6163
github.com/bytedance/sonic/loader v0.2.0 // indirect
6264
github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b // indirect
65+
github.com/catppuccin/go v0.2.0 // indirect
6366
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
6467
github.com/cespare/xxhash v1.1.0 // indirect
6568
github.com/cespare/xxhash/v2 v2.3.0 // indirect
69+
github.com/charmbracelet/bubbles v0.20.0 // indirect
70+
github.com/charmbracelet/bubbletea v1.1.1 // indirect
71+
github.com/charmbracelet/huh v0.6.0 // indirect
72+
github.com/charmbracelet/huh/spinner v0.0.0-20241028115900-20a4d21717a8 // indirect
73+
github.com/charmbracelet/lipgloss v0.13.0 // indirect
74+
github.com/charmbracelet/x/ansi v0.2.3 // indirect
75+
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect
76+
github.com/charmbracelet/x/term v0.2.0 // indirect
6677
github.com/cloudwego/base64x v0.1.4 // indirect
6778
github.com/cloudwego/iasm v0.2.0 // indirect
6879
github.com/coder/websocket v1.8.12 // indirect
@@ -73,6 +84,7 @@ require (
7384
github.com/coreos/go-semver v0.3.1 // indirect
7485
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
7586
github.com/cpuguy83/dockercfg v0.3.2 // indirect
87+
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
7688
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
7789
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
7890
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@@ -87,6 +99,7 @@ require (
8799
github.com/dustin/go-humanize v1.0.1 // indirect
88100
github.com/edsrzf/mmap-go v1.1.0 // indirect
89101
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
102+
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
90103
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
91104
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect
92105
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect
@@ -161,14 +174,18 @@ require (
161174
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
162175
github.com/kylelemons/godebug v1.1.0 // indirect
163176
github.com/leodido/go-urn v1.4.0 // indirect
177+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
164178
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
165179
github.com/magiconair/properties v1.8.7 // indirect
166180
github.com/mailru/easyjson v0.7.7 // indirect
167181
github.com/mattn/go-colorable v0.1.13 // indirect
168182
github.com/mattn/go-isatty v0.0.20 // indirect
183+
github.com/mattn/go-localereader v0.0.1 // indirect
184+
github.com/mattn/go-runewidth v0.0.16 // indirect
169185
github.com/miekg/dns v1.1.56 // indirect
170186
github.com/mitchellh/copystructure v1.0.0 // indirect
171187
github.com/mitchellh/go-homedir v1.1.0 // indirect
188+
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
172189
github.com/mitchellh/mapstructure v1.5.0 // indirect
173190
github.com/mitchellh/reflectwalk v1.0.1 // indirect
174191
github.com/mmcloughlin/addchain v0.4.0 // indirect
@@ -183,6 +200,9 @@ require (
183200
github.com/montanaflynn/stats v0.7.1 // indirect
184201
github.com/morikuni/aec v1.0.0 // indirect
185202
github.com/mr-tron/base58 v1.2.0 // indirect
203+
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
204+
github.com/muesli/cancelreader v0.2.2 // indirect
205+
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect
186206
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
187207
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
188208
github.com/oklog/ulid v1.3.1 // indirect
@@ -191,6 +211,7 @@ require (
191211
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e // indirect
192212
github.com/opentracing-contrib/go-stdlib v1.0.0 // indirect
193213
github.com/opentracing/opentracing-go v1.2.0 // indirect
214+
github.com/pelletier/go-toml v1.9.5 // indirect
194215
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
195216
github.com/pierrec/lz4/v4 v4.1.21 // indirect
196217
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
@@ -205,8 +226,10 @@ require (
205226
github.com/prometheus/exporter-toolkit v0.10.1-0.20230714054209-2f4150c63f97 // indirect
206227
github.com/prometheus/procfs v0.15.1 // indirect
207228
github.com/prometheus/prometheus v0.47.2-0.20231010075449-4b9c19fe5510 // indirect
229+
github.com/rivo/uniseg v0.4.7 // indirect
208230
github.com/rogpeppe/go-internal v1.13.1 // indirect
209231
github.com/rs/zerolog v1.33.0 // indirect
232+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
210233
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
211234
github.com/sercand/kuberesolver/v5 v5.1.1 // indirect
212235
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
@@ -227,7 +250,9 @@ require (
227250
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
228251
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
229252
github.com/ugorji/go/codec v1.2.12 // indirect
253+
github.com/urfave/cli/v2 v2.27.5 // indirect
230254
github.com/x448/float16 v0.8.4 // indirect
255+
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
231256
github.com/yusufpapurcu/wmi v1.2.3 // indirect
232257
go.etcd.io/etcd/api/v3 v3.5.14 // indirect
233258
go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect

0 commit comments

Comments
 (0)