Skip to content

Commit 39fa6eb

Browse files
committed
move promtail to ctf obs up, speed up
1 parent 50c268e commit 39fa6eb

File tree

10 files changed

+14
-15
lines changed

10 files changed

+14
-15
lines changed

framework/.changeset/v0.3.8.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Move promtail to CLI
2+
- Speed up container polling
3+
- Allow debug entrypoint for dlv

framework/cmd/interactive.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ func createComponentsFromForm(form *nodeSetForm) error {
7575
}
7676
switch form.Observability {
7777
case true:
78-
if err = framework.NewPromtail(); err != nil {
79-
return err
80-
}
8178
if err := observabilityUp(); err != nil {
8279
return err
8380
}

framework/cmd/observability.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ func observabilityUp() error {
1010
if err := extractAllFiles("observability"); err != nil {
1111
return err
1212
}
13+
if err := framework.NewPromtail(); err != nil {
14+
return err
15+
}
1316
err := runCommand("bash", "-c", fmt.Sprintf(`
1417
cd %s && \
1518
docker compose up -d

framework/components/blockchain/anvil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func newAnvil(in *Input) (*Output, error) {
5353
NetworkAliases: map[string][]string{
5454
framework.DefaultNetworkName: {containerName},
5555
},
56-
WaitingFor: wait.ForListeningPort(nat.Port(in.Port)).WithStartupTimeout(10 * time.Second),
56+
WaitingFor: wait.ForListeningPort(nat.Port(in.Port)).WithStartupTimeout(10 * time.Second).WithPollInterval(200 * time.Millisecond),
5757
Entrypoint: entryPoint,
5858
}
5959
c, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{

framework/components/blockchain/besu.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func newBesu(in *Input) (*Output, error) {
8282
},
8383
}
8484
},
85-
WaitingFor: wait.ForListeningPort(nat.Port(in.Port)).WithStartupTimeout(15 * time.Second),
85+
WaitingFor: wait.ForListeningPort(nat.Port(in.Port)).WithStartupTimeout(15 * time.Second).WithPollInterval(200 * time.Millisecond),
8686
Cmd: entryPoint,
8787
}
8888

framework/components/blockchain/geth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func newGeth(in *Input) (*Output, error) {
191191
FileMode: 0644,
192192
},
193193
},
194-
WaitingFor: wait.ForListeningPort(nat.Port(in.Port)).WithStartupTimeout(15 * time.Second),
194+
WaitingFor: wait.ForListeningPort(nat.Port(in.Port)).WithStartupTimeout(15 * time.Second).WithPollInterval(200 * time.Millisecond),
195195
Cmd: entryPoint,
196196
}
197197
c, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{

framework/components/clnode/clnode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func newNode(in *Input, pgOut *postgres.Output) (*NodeOut, error) {
222222
"/bin/sh", "-c",
223223
"chainlink -c /config/config -c /config/overrides -c /config/user-overrides -s /config/secrets -s /config/secrets-overrides -s /config/user-secrets-overrides node start -d -p /config/node_password -a /config/apicredentials",
224224
},
225-
WaitingFor: wait.ForHTTP("/").WithPort(DefaultHTTPPort).WithStartupTimeout(2 * time.Minute),
225+
WaitingFor: wait.ForHTTP("/").WithPort(DefaultHTTPPort).WithStartupTimeout(1 * time.Minute).WithPollInterval(200 * time.Millisecond),
226226
}
227227
if in.Node.HTTPPort != 0 && in.Node.P2PPort != 0 {
228228
req.HostConfigModifier = func(h *container.HostConfig) {

framework/components/postgres/postgres.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ func NewPostgreSQL(in *Input) (*Output, error) {
107107
},
108108
WaitingFor: tcwait.ForExec([]string{"psql", "-h", "127.0.0.1",
109109
"-U", User, "-p", Port, "-c", "select", "1", "-d", Database}).
110-
WithStartupTimeout(20 * time.Second).
111-
WithPollInterval(1 * time.Second),
110+
WithStartupTimeout(15 * time.Second).
111+
WithPollInterval(200 * time.Millisecond),
112112
}
113113
var portToExpose int
114114
if in.Port != 0 {

framework/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ func Load[X any](t *testing.T) (*X, error) {
144144
//}
145145
err = DefaultNetwork(once)
146146
require.NoError(t, err)
147-
if os.Getenv(EnvVarCI) != "true" {
148-
err = NewPromtail()
149-
require.NoError(t, err)
150-
}
151147
return input, nil
152148
}
153149

framework/promtail.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ scrape_configs:
5959
lokiTenantID := os.Getenv("LOKI_TENANT_ID")
6060

6161
if lokiURL == "" {
62-
lokiURL = "http://host.docker.internal:3030/loki/api/v1/push"
62+
lokiURL = "http://host.docker.internal:3100/loki/api/v1/push"
6363
}
6464
if lokiTenantID == "" {
6565
lokiTenantID = "promtail"
@@ -108,7 +108,7 @@ scrape_configs:
108108
}
109109

110110
func NewPromtail() error {
111-
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
111+
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
112112
defer cancel()
113113

114114
pcn, err := promtailConfig()

0 commit comments

Comments
 (0)