rm more
This commit is contained in:
parent
b778e78bde
commit
7c7d532980
|
@ -1,64 +0,0 @@
|
||||||
# Nimbus
|
|
||||||
# Copyright (c) 2023 Status Research & Development GmbH
|
|
||||||
# Licensed under either of
|
|
||||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
||||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
||||||
# http://opensource.org/licenses/MIT)
|
|
||||||
# at your option. This file may not be copied, modified, or distributed except
|
|
||||||
# according to those terms.
|
|
||||||
|
|
||||||
import
|
|
||||||
./step
|
|
||||||
|
|
||||||
# A step that attempts to peer to the client using devp2p, and checks the forkid of the client
|
|
||||||
type DevP2PClientPeering struct {
|
|
||||||
# Client index to peer to
|
|
||||||
ClientIndex uint64
|
|
||||||
}
|
|
||||||
|
|
||||||
func (step DevP2PClientPeering) Execute(t *CancunTestContext) error {
|
|
||||||
# Get client index's enode
|
|
||||||
if step.ClientIndex >= uint64(len(t.TestEngines)) {
|
|
||||||
return error "invalid client index %d", step.ClientIndex)
|
|
||||||
}
|
|
||||||
engine = t.Engines[step.ClientIndex]
|
|
||||||
conn, err = devp2p.PeerEngineClient(engine, env.clMock)
|
|
||||||
if err != nil {
|
|
||||||
return error "error peering engine client: %v", err)
|
|
||||||
}
|
|
||||||
defer conn.Close()
|
|
||||||
info "Connected to client %d, remote public key: %s", step.ClientIndex, conn.RemoteKey())
|
|
||||||
|
|
||||||
# Sleep
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
|
|
||||||
# Timeout value for all requests
|
|
||||||
timeout = 20 * time.Second
|
|
||||||
|
|
||||||
# Send a ping request to verify that we are not immediately disconnected
|
|
||||||
pingReq = &devp2p.Ping{}
|
|
||||||
if size, err = conn.Write(pingReq); err != nil {
|
|
||||||
return errors.Wrap(err, "could not write to conn")
|
|
||||||
else:
|
|
||||||
info "Wrote %d bytes to conn", size)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Finally wait for the pong response
|
|
||||||
msg, err = conn.WaitForResponse(timeout, 0)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "error waiting for response")
|
|
||||||
}
|
|
||||||
switch msg = msg.(type) {
|
|
||||||
case *devp2p.Pong:
|
|
||||||
info "Received pong response: %v", msg)
|
|
||||||
default:
|
|
||||||
return error "unexpected message type: %T", msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (step DevP2PClientPeering) Description() string {
|
|
||||||
return fmt.Sprintf("DevP2PClientPeering: client %d", step.ClientIndex)
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
# Nimbus
|
|
||||||
# Copyright (c) 2023 Status Research & Development GmbH
|
|
||||||
# Licensed under either of
|
|
||||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
||||||
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
||||||
# http://opensource.org/licenses/MIT)
|
|
||||||
# at your option. This file may not be copied, modified, or distributed except
|
|
||||||
# according to those terms.
|
|
||||||
|
|
||||||
import
|
|
||||||
./step
|
|
||||||
|
|
||||||
# A step that runs two or more steps in parallel
|
|
||||||
type ParallelSteps struct {
|
|
||||||
Steps []TestStep
|
|
||||||
}
|
|
||||||
|
|
||||||
func (step ParallelSteps) Execute(t *CancunTestContext) error {
|
|
||||||
# Run the steps in parallel
|
|
||||||
wg = sync.WaitGroup{}
|
|
||||||
errs = make(chan error, len(step.Steps))
|
|
||||||
for _, s = range step.Steps {
|
|
||||||
wg.Add(1)
|
|
||||||
go func(s TestStep) {
|
|
||||||
defer wg.Done()
|
|
||||||
if err = s.Execute(t); err != nil {
|
|
||||||
errs <- err
|
|
||||||
}
|
|
||||||
}(s)
|
|
||||||
}
|
|
||||||
wg.Wait()
|
|
||||||
close(errs)
|
|
||||||
for err = range errs {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (step ParallelSteps) Description() string {
|
|
||||||
desc = "ParallelSteps: running steps in parallel:\n"
|
|
||||||
for i, step = range step.Steps {
|
|
||||||
desc += fmt.Sprintf("%d: %s\n", i, step.Description())
|
|
||||||
}
|
|
||||||
|
|
||||||
return desc
|
|
||||||
}
|
|
Loading…
Reference in New Issue