Skip to content

Commit c50f93f

Browse files
Merge branch 'master' into stamp-funder
2 parents 07386ae + a02803a commit c50f93f

File tree

11 files changed

+224
-52
lines changed

11 files changed

+224
-52
lines changed

cmd/beekeeper/cmd/check.go

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,29 +120,27 @@ func (c *command) initCheckCmd() error {
120120
}
121121
chk = beekeeper.NewActionMiddleware(tracer, chk, checkName)
122122

123-
if checkConfig.Timeout != nil {
124-
ctx, cancel = context.WithTimeout(ctx, *checkConfig.Timeout)
125-
defer cancel()
126-
}
123+
checkCtx, cancelCheck := createChildContext(ctx, checkConfig.Timeout)
124+
defer cancelCheck()
127125

128126
c.log.Infof("running check: %s", checkName)
129127

130128
ch := make(chan error, 1)
131129
go func() {
132-
ch <- chk.Run(ctx, cluster, o)
130+
ch <- chk.Run(checkCtx, cluster, o)
133131
close(ch)
134132
}()
135133

136134
select {
137-
case <-ctx.Done():
138-
deadline, ok := ctx.Deadline()
135+
case <-checkCtx.Done():
136+
deadline, ok := checkCtx.Deadline()
139137
if ok {
140-
return fmt.Errorf("running check %s: %w: deadline %v", checkName, ctx.Err(), deadline)
138+
return fmt.Errorf("running check %s: %w: deadline %v", checkName, checkCtx.Err(), deadline)
141139
}
142-
return fmt.Errorf("running check %s: %w", checkName, ctx.Err())
140+
return fmt.Errorf("check %s failed due to: %w", checkName, checkCtx.Err())
143141
case err = <-ch:
144142
if err != nil {
145-
return fmt.Errorf("running check %s: %w", checkName, err)
143+
return fmt.Errorf("check %s failed with error: %w", checkName, err)
146144
}
147145
c.log.Infof("%s check completed successfully", checkName)
148146
}
@@ -164,3 +162,10 @@ func (c *command) initCheckCmd() error {
164162

165163
return nil
166164
}
165+
166+
func createChildContext(ctx context.Context, timeout *time.Duration) (context.Context, context.CancelFunc) {
167+
if timeout != nil {
168+
return context.WithTimeout(ctx, *timeout)
169+
}
170+
return context.WithCancel(ctx)
171+
}

config/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ checks:
212212
max-pathname-length: 64
213213
postage-amount: 1000
214214
postage-depth: 17
215-
timeout: 5m
215+
timeout: 30m
216216
type: manifest
217217
networkavailability:
218218
options:
@@ -348,7 +348,7 @@ checks:
348348
insufficient-amount: 102400
349349
contract-addr: "0xfc28330f1ecE0ef2371B724E0D19c1EE60B728b2"
350350
private-key: "4663c222787e30c1994b59044aa5045377a6e79193a8ead88293926b535c722d"
351-
geth-url: "http://geth-swap.bee-playground.testnet.internal"
351+
geth-url: "http://geth-swap.bee-playground.svc.swarm1.local:8545"
352352
geth-chain-id: 12345
353353
withdraw:
354354
options:

config/local.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ checks:
204204
max-pathname-length: 64
205205
postage-amount: 1000
206206
postage-depth: 17
207-
timeout: 5m
207+
timeout: 30m
208208
type: manifest
209209
ci-pingpong:
210210
options:

config/public-testnet.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@ bee-configs:
4747
sepolia:
4848
_inherit: ""
4949
bootnodes: "/dnsaddr/testnet.ethswarm.org"
50+
full-node: true
5051

5152
checks:
53+
pt-pingpong:
54+
options:
55+
timeout: 30m
56+
type: pingpong
5257
pt-retrieval:
5358
options:
5459
chunks-per-node: 3
@@ -76,7 +81,7 @@ checks:
7681
max-pathname-length: 64
7782
postage-amount: 140000000
7883
postage-depth: 17
79-
timeout: 5m
84+
timeout: 30m
8085
type: manifest
8186
pt-pss:
8287
options:
@@ -146,6 +151,7 @@ checks:
146151
postage-amount: 140000000
147152
postage-depth: 20
148153
postage-label: feed-label
154+
timeout: 30m
149155
type: feed
150156
pt-feed-availability:
151157
options:

pkg/bee/api/api.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const (
3434
swarmSocSignatureHeader = "Swarm-Soc-Signature"
3535
swarmFeedIndexHeader = "Swarm-Feed-Index"
3636
swarmFeedIndexNextHeader = "Swarm-Feed-Index-Next"
37+
swarmIndexDocumentHeader = "Swarm-Index-Document"
38+
swarmErrorDocumentHeader = "Swarm-Error-Document"
3739
)
3840

3941
var userAgent = "beekeeper/" + beekeeper.Version
@@ -340,6 +342,10 @@ type UploadOptions struct {
340342
BatchID string
341343
Direct bool
342344
ActHistoryAddress swarm.Address
345+
346+
// Dirs
347+
IndexDocument string
348+
ErrorDocument string
343349
}
344350

345351
type DownloadOptions struct {

pkg/bee/api/dirs.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ func (s *DirsService) Upload(ctx context.Context, data io.Reader, size int64, o
3030
header.Set("swarm-collection", "True")
3131
header.Set(postageStampBatchHeader, o.BatchID)
3232

33+
if o.IndexDocument != "" {
34+
header.Set(swarmIndexDocumentHeader, o.IndexDocument)
35+
}
36+
if o.ErrorDocument != "" {
37+
header.Set(swarmErrorDocumentHeader, o.ErrorDocument)
38+
}
39+
3340
err = s.client.requestWithHeader(ctx, http.MethodPost, "/"+apiVersion+"/bzz", header, data, &resp)
3441

3542
return

0 commit comments

Comments
 (0)